<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using layer.extrusion in a Python script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1228106#M66010</link>
    <description>&lt;P&gt;Thanks a lot, it worked perfectly and I would never have thought of it!&lt;/P&gt;</description>
    <pubDate>Wed, 02 Nov 2022 22:08:59 GMT</pubDate>
    <dc:creator>clc</dc:creator>
    <dc:date>2022-11-02T22:08:59Z</dc:date>
    <item>
      <title>Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1227755#M65994</link>
      <description>&lt;P&gt;I am developing a Python script tool to transform a 2D feature class into a multipatch.&lt;/P&gt;&lt;P&gt;Right now, I have to split the script into 2 scripts and manually do the extrusion, because I cannot figure out how to make the extrusion based on a field. I could apply a fixed extrusion by writing:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;expression = &lt;/SPAN&gt;&lt;SPAN&gt;"5"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;lyr.extrusion(&lt;/SPAN&gt;&lt;SPAN&gt;"BASE_HEIGHT"&lt;/SPAN&gt;&lt;SPAN&gt;, expression)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;But I would like a extrusion based on one of the field of my feature class (and also set the unit as it is possible in the Feature Layer Tab in Pro). I tried (among other combinations):&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;expression = &lt;/SPAN&gt;&lt;SPAN&gt;"!Extrusion_ft! / 3.28084"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;lyr.extrusion(&lt;/SPAN&gt;&lt;SPAN&gt;"BASE_HEIGHT"&lt;/SPAN&gt;&lt;SPAN&gt;, expression)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;The script runs without error but no extrusion...&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks for any help.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 02 Nov 2022 02:11:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1227755#M65994</guid>
      <dc:creator>clc</dc:creator>
      <dc:date>2022-11-02T02:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1227828#M65997</link>
      <description>&lt;P&gt;You can get the value field from a SearchCursor and then use it in your expression.&lt;/P&gt;&lt;P&gt;expression = str(list(set([hgts[0] for hgts in arcpy.da.SearchCursor(fc, 'Field holding hgt')]))[0])&lt;/P&gt;&lt;P&gt;This will grab the first value from the distinct list in case your field has multiple differing values.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 11:06:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1227828#M65997</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-11-02T11:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1228106#M66010</link>
      <description>&lt;P&gt;Thanks a lot, it worked perfectly and I would never have thought of it!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 22:08:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1228106#M66010</guid>
      <dc:creator>clc</dc:creator>
      <dc:date>2022-11-02T22:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1228144#M66011</link>
      <description>&lt;P&gt;Sorry to ask again, but I just realized that it did not work completely for me. The extrusion expression holds only one value (the one of the first feature), so the extrusion is the same for all the features in the layer.&lt;/P&gt;&lt;P&gt;I tried to pass the list of field values (which would match each feature with its field value) but no extrusion happened.&amp;nbsp; Any&amp;nbsp; suggestions? Thanks again.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2022 23:44:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1228144#M66011</guid>
      <dc:creator>clc</dc:creator>
      <dc:date>2022-11-02T23:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1228160#M66012</link>
      <description>&lt;P&gt;I was wondering about that and was going to add a warning that it would set every feature to that single height... I don't think there is mechanism yet for 'extrude by attribute' programmatically beyond this single value. That polygon image in the docs is a little misleading and I think it was the result of the manual process they listed below... but, the expression parameter makes me curious if one could use an arcade expression there...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;"return $feature.HeightField"&lt;/LI-CODE&gt;&lt;P&gt;I haven't seen anything regarding arcade in arcpy so I'd be surprised if that worked.&amp;nbsp; Might be worth posting this to the ideas section.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 01:36:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1228160#M66012</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-11-03T01:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1228393#M66017</link>
      <description>&lt;P&gt;Yes the doc is very misleading. You would think that because it is written expression, you could enter more than one value!&lt;/P&gt;&lt;P&gt;I had noticed too that the expression for the feature layer extrusion in Pro offered only Arcade and VBScript. I tried your suggestion for returning an Arcade expression, but no success as you feared it. Thanks again for your help. I think I may end up splitting my layer by extrusion values, do the extrusion for each, run&amp;nbsp;&lt;SPAN&gt;arcpy.Layer3DToFeatureClass_3d on each and combined all the features.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 16:18:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1228393#M66017</guid>
      <dc:creator>clc</dc:creator>
      <dc:date>2022-11-03T16:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1231001#M66057</link>
      <description>&lt;P&gt;To conclude on the subject, in case someone encountered the same difficulty:&lt;/P&gt;&lt;P&gt;I managed to finish my script to create a multipatch fc from a 2d polygon fc. I had 2 huge hurdles: the extrusion and the symbology. For the extrusion, I decided to use Python CIM access. I created an extrusion object with my field as expression and I updated the CIM definition of my layer. For the symbology, I applied the workaround already discussed: creating a new layer and using updateConnectionProperties on the new layer.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2022 22:18:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1231001#M66057</guid>
      <dc:creator>clc</dc:creator>
      <dc:date>2022-11-11T22:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1345089#M69127</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/531405"&gt;@clc&lt;/a&gt;&amp;nbsp;, how did you end up modifying the cim extrusion. I am not finding any python documentation for this. Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 16:52:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1345089#M69127</guid>
      <dc:creator>AnonymousUser23</dc:creator>
      <dc:date>2023-11-02T16:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1345125#M69129</link>
      <description>&lt;P&gt;I used:&amp;nbsp;&lt;SPAN&gt;CreateCIMObjectFromClassName found in the Creating CIM objects section of&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm#" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm#&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;# Get the layer CIM definition of my layer to be extruded&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;cim_lay = lay.getDefinition('V2')&lt;/P&gt;&lt;P&gt;# Create a CIM object&lt;/P&gt;&lt;P&gt;cim_obj = arcpy.cim.CreateCIMObjectFromClassName('CIMFeatureExtrusion','V2')&lt;/P&gt;&lt;P&gt;cim_obj.extrusionType = 'Base'&lt;/P&gt;&lt;P&gt;cim_obj.extrusionUnit = {'uwkid': 9002}&lt;/P&gt;&lt;P&gt;cim_obj.extrusionExpressionInfo.expression = '$feature.Extrusion_ft'&lt;/P&gt;&lt;P&gt;# Set the extrusion property&amp;nbsp;&lt;/P&gt;&lt;P&gt;cim_lay.extrusion = cim_obj&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hope this helps. Catherine&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 17:36:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1345125#M69129</guid>
      <dc:creator>clc</dc:creator>
      <dc:date>2023-11-02T17:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1345258#M69130</link>
      <description>&lt;P&gt;Thanks Catherine. I also knocked it out. I noticed in Pro 3.1 that my 2D layer would not move to 3D without marking isflattened to false. Just for anyone else trying to do this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;cim&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;l&lt;/SPAN&gt;&lt;SPAN&gt;.getDefinition(&lt;/SPAN&gt;&lt;SPAN&gt;'V3'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;expressioninfo&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;arcpy&lt;/SPAN&gt;&lt;SPAN&gt;.cim.CreateCIMObjectFromClassName(&lt;/SPAN&gt;&lt;SPAN&gt;'CIMExpressionInfo'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'V3'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;expressioninfo&lt;/SPAN&gt;&lt;SPAN&gt;.expression &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;40&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;expressioninfo&lt;/SPAN&gt;&lt;SPAN&gt;.title &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"Custom"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;extrude&lt;/SPAN&gt; &lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;arcpy&lt;/SPAN&gt;&lt;SPAN&gt;.cim.CreateCIMObjectFromClassName(&lt;/SPAN&gt;&lt;SPAN&gt;'CIMFeatureExtrusion'&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;'V3'&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;extrude&lt;/SPAN&gt;&lt;SPAN&gt;.extrusionType &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"Base"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;extrude&lt;/SPAN&gt;&lt;SPAN&gt;.extrusionExpressionInfo &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;expressioninfo&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;cim&lt;/SPAN&gt;&lt;SPAN&gt;.extrusion &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;extrude&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;cim&lt;/SPAN&gt;&lt;SPAN&gt;.isFlattened &lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt; &lt;SPAN&gt;"false"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 02 Nov 2023 20:31:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1345258#M69130</guid>
      <dc:creator>AnonymousUser23</dc:creator>
      <dc:date>2023-11-02T20:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Using layer.extrusion in a Python script</title>
      <link>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1589523#M73805</link>
      <description>&lt;P&gt;I have been looking for a solution like this for quite some time. Thank you &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/655896"&gt;@AnonymousUser23&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/531405"&gt;@clc&lt;/a&gt;&amp;nbsp;for sharing your code and solutions. The [isFlattened = "false"] was also key in my testing. Thank you both!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2025 16:30:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-layer-extrusion-in-a-python-script/m-p/1589523#M73805</guid>
      <dc:creator>WilliamLee</dc:creator>
      <dc:date>2025-02-26T16:30:18Z</dc:date>
    </item>
  </channel>
</rss>

