Expose Blend Modes to Arcpy.mp Module

381
3
12-20-2023 10:48 AM
Status: Open
Labels (1)
MErikReedAugusta
Occasional Contributor III

It's entirely possible this exists, and I just haven't been able to find it, but given blend modes themselves seem pretty new, I'm going to hazard a guess it doesn't exist, yet.

Problem/Use Case:

I'm currently building a tool that automatically pulls selected as-built & design drawings for an area into the active map.  In pretty much all of our cases, the imported drawings are a georeferenced image file of a white page with black text & geometry.  So I pretty much always set these to a blend mode of "Multiply".  However, I'm pulling them into the map via the arcpy.mp mapping module, and there doesn't seem to be any way to set the blend mode from the script.

This means after the script has pulled all the records in, I have to manually set them all to have a blend mode of Multiply.  Nu beuno.

Proposal:

Expose the Layer/Feature Blend of a given Layer to the arcpy.mp module, so we can both read and write it via scripts.

3 Comments
JeffBarrette

@MErikReedAugusta have you tried using Python CIM Access

I just tried quickly with the following code:

p = arcpy.mp.ArcGISProject('current')
m = p.listMaps()[0]
l = m.listLayers('Photo0')[0]
l_cim = l.getDefinition('V3')
l_cim.l_cim.blendingMode = 'Multiply'  #Was Normal
l.setDefinition(l_cim)

 

Jeff - Layout and arcpy.mp teams

MErikReedAugusta

Ah, this might work; I'll have to spelunk into this later today.

Thanks for the pointer.  I haven't ready the mapping documentation "cover-to-cover", yet, and the organic digging I was doing yesterday hadn't turned this up, yet.

JeffBarrette

@MErikReedAugusta Python CIM Access is a way to get to properties we don't expose to our curated API.  We expose focused capabilities and use the CIM for the less common features.  Review the help topic to get a better understanding and please let me know if this helped.  I'll mark the topic as "already offered".

Jeff - Layout and arcpy.mp teams