<?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 How to Format Polygon Symbol via Python? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-format-polygon-symbol-via-python/m-p/1132027#M49755</link>
    <description>&lt;P&gt;Is there a way to programmatically access and change the properties of a symbol (or part of it, e.g. pattern agnle) as shown in the window below?&lt;/P&gt;&lt;P&gt;I am aware of the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/symbol-class.htm" target="_self"&gt;symbol class&lt;/A&gt; and its properties.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="ArcGISPro_2D8YbkG63d.png" style="width: 185px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31102iDEA5268C85CD24C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ArcGISPro_2D8YbkG63d.png" alt="ArcGISPro_2D8YbkG63d.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jan 2022 14:42:42 GMT</pubDate>
    <dc:creator>dazu</dc:creator>
    <dc:date>2022-01-10T14:42:42Z</dc:date>
    <item>
      <title>How to Format Polygon Symbol via Python?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-format-polygon-symbol-via-python/m-p/1132027#M49755</link>
      <description>&lt;P&gt;Is there a way to programmatically access and change the properties of a symbol (or part of it, e.g. pattern agnle) as shown in the window below?&lt;/P&gt;&lt;P&gt;I am aware of the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/symbol-class.htm" target="_self"&gt;symbol class&lt;/A&gt; and its properties.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="ArcGISPro_2D8YbkG63d.png" style="width: 185px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31102iDEA5268C85CD24C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ArcGISPro_2D8YbkG63d.png" alt="ArcGISPro_2D8YbkG63d.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 14:42:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-format-polygon-symbol-via-python/m-p/1132027#M49755</guid>
      <dc:creator>dazu</dc:creator>
      <dc:date>2022-01-10T14:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Polygon Symbol via Python?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-format-polygon-symbol-via-python/m-p/1132028#M49756</link>
      <description>&lt;P&gt;No.&amp;nbsp; You found CIM.&amp;nbsp; That is all for python access.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 14:48:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-format-polygon-symbol-via-python/m-p/1132028#M49756</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-01-10T14:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Polygon Symbol via Python?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-format-polygon-symbol-via-python/m-p/1132048#M49759</link>
      <description>&lt;P&gt;Wow... that was quick. Thank you, &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;, for pointing me to Esri's &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm" target="_self"&gt;Cartographic Information Model&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;The section &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm#ESRI_SECTION1_20A05482BA6249D09353BF7CA185C1AD" target="_self"&gt;Additional Resources and Sample Scripts&lt;/A&gt; links to the GitHub repository and a sample project with a script to create a dashed effect:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Author:  Esri
# Date:    March 2020
# Version: ArcGISPro 2.5
# Purpose: This script creates or modifies the dash effects for a line symbol.
# Notes:   - The script is intended to work from a script tool provided with
#            a sample project using "CURRENT".  To see the changes happen be
#            sure to activate the appropriate map or layout.
#          - In addition to this sample script demonstating how the CIM
#            provides access to capabilities not in the managed Python API,
#            is also demonstrates a method for creating CIM objects that are
#            necessary to set desired properties.

p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('Symbology')[0]
l = m.listLayers('States_SingleSymbol')[0]

l_cim = l.getDefinition('V2')         #Get the Layer's CIM definition

#Symbol Level 1 (Solid Stroke)
symLvl1 = l_cim.renderer.symbol.symbol.symbolLayers[0]

#If a dashed effect does not exist, create one
if len(symLvl1.effects) == 0:
  newDash = arcpy.cim.CreateCIMObjectFromClassName('CIMGeometricEffectDashes', 'V2')
  newDash.dashTemplate = [5, 5]
  symLvl1.effects = [newDash]
#If a dashed effects does exist, modify it
else:
  dash = symLvl1.effects[0]
  dash.dashTemplate = [10, 10]

l.setDefinition(l_cim)                #Set the Layer's CIM definition&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This serves as a good starting point. Do you know of an easy way to expose the JSON structure of existing symbol styles? Or how to gain insight into the hierarchy?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jan 2022 16:11:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-format-polygon-symbol-via-python/m-p/1132048#M49759</guid>
      <dc:creator>dazu</dc:creator>
      <dc:date>2022-01-10T16:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to Format Polygon Symbol via Python?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-format-polygon-symbol-via-python/m-p/1132069#M49763</link>
      <description>&lt;LI-CODE lang="python"&gt;help(arcpy.cim)
arcpy.cim.GetJSONForCIMObject(l_cim, "V2")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 10 Jan 2022 16:36:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-format-polygon-symbol-via-python/m-p/1132069#M49763</guid>
      <dc:creator>dazu</dc:creator>
      <dc:date>2022-01-10T16:36:00Z</dc:date>
    </item>
  </channel>
</rss>

