Select to view content in your preferred language

Applying an extrusion to multiple layer from a python script

951
4
11-13-2017 03:05 PM
PeteCoventry3
Deactivated User

I'm trying to apply a Base Height extrusion that's 10 feet in height to all layers in my ArcGIS Pro map document using a python script. Per ESRI's documentation on extrusion, the syntax should be

extrusion ({extrusion_type}, {expression}) .‍‍

Below is a sample of code I'm trying to use.  It's certainly not graceful as I'm still trying to learn python. 

# Apply extrusion    
for lyr in m.listLayers("CONDO*"):
if lyr.supports("EXTRUSION"):
    lyr.extrusion('BASE_HEIGHT',10)‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I'm not receiving any error when I run the script nor is it making updates to the layers. Any suggestions would be greatly appreciated!

Tags (3)
0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

question.... is it in the dataframe as you run the script (see RefreshActiveView) or after the project is saved and reopened? or it just doesn't plain work?

0 Kudos
PeteCoventry3
Deactivated User

Yes, the layer is in the dataframe as I run the script.  I was seeing where you were going with this and added the RefreshActiveView and still nothing.

for lyr in m.listLayers("CONDO*"):
if lyr.supports("EXTRUSION"):
lyr.extrusion('BASE_HEIGHT',10)
arcpy.RefreshActiveView()
0 Kudos
DanPatterson_Retired
MVP Emeritus
0 Kudos
PeteCoventry3
Deactivated User

Turns out I forgot the geoprocess - Layer 3D To Feature Class. That's why my extrusion wasn't working.  Thanks for your help though!

0 Kudos