<?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 Polyline line width not changing when specified in code for .pyt toolbox in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/polyline-line-width-not-changing-when-specified-in/m-p/1634006#M97330</link>
    <description>&lt;P&gt;I have this code that functionally works, it takes the layers i defined and then changes their colors and sizes and/or width. The problem I am encountering is that none of my polylines want to change width to 2, it keeps the default of 1, but their color is changing so I do not know why it is not doing it.&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

class Toolbox(object):
    def __init__(self):
        self.label = "SymbologyToolbox"
        self.alias = "SymbologyToolbox"
        self.tools = [SetSymbology]

class SetSymbology(object):
    def __init__(self):
        self.label = "Set Layer Symbology"
        self.description = "Applies color/size rules to layers in the active map."

    def getParameterInfo(self):
        return []

    def isLicensed(self):
        return True

    def updateParameters(self, parameters):
        return

    def updateMessages(self, parameters):
        return

    def execute(self, parameters, messages):
        aprx = arcpy.mp.ArcGISProject("CURRENT")
        map = aprx.activeMap
        arcpy.management.Delete("in_memory")

        point_rules = {
            "SECTION_CORNER": {"color": [115, 178, 255, 100], "size": 6},
        }
        point_default = {"color": [163, 255, 115, 100], "size": 5}

        polygon_rules = {
            "TOPO_HAZARD_PY": {"color": [221, 155, 255, 100]},
        }
        polygon_default = {"color": [255, 255, 190, 100]}

        line_rules = {
            "ROW_EDGES": {"color": [255, 0, 0, 100], "width": 2},
            "TOPO_HAZARD_LN": {"color": [255, 0, 0, 100], "width": 2},
            "ASB_ELECTRICAL": {"color": [85, 255, 0, 100], "width": 2},
            "ROW_ELECTRICAL": {"color": [85, 255, 0, 100], "width": 2},
            "TOPO_ELECTRICAL": {"color": [85, 255, 0, 100], "width": 2},
            "ASB_FIBERLINE": {"color": [255, 170, 0, 100], "width": 2},
            "ROW_FIBERLINE": {"color": [255, 170, 0, 100], "width": 2},
            "TOPO_FIBERLINE": {"color": [255, 170, 0, 100], "width": 2},
            "ASB_FLOWLINE": {"color": [255, 115, 223, 100], "width": 2},
            "ROW_FLOWLINE": {"color": [255, 115, 223, 100], "width": 2},
            "TOPO_FLOWLINE": {"color": [255, 115, 223, 100], "width": 2},
            "WELL_PATH_PLAN": {"color": [255, 115, 223, 100], "width": 2},
            "ASB_MULTIUSE": {"color": [0, 112, 255, 100], "width": 2},
            "ROW_MULTIUSE": {"color": [0, 112, 255, 100], "width": 2},
            "TOPO_MULTIUSE": {"color": [0, 112, 255, 100], "width": 2},
            "ASB_PIPELINE": {"color": [197, 0, 255, 100], "width": 2},
            "ROW_PIPELINE": {"color": [197, 0, 255, 100], "width": 2},
            "TOPO_PIPELINE": {"color": [197, 0, 255, 100], "width": 2},
            "ASB_ROAD": {"color": [255, 255, 0, 100], "width": 2},
            "ROW_ROAD": {"color": [255, 255, 0, 100], "width": 2},
            "TOPO_ROAD": {"color": [255, 255, 0, 100], "width": 2}
        }

        for lyr in map.listLayers():
            if lyr.isFeatureLayer:
                desc = arcpy.Describe(lyr)
                geom = desc.shapeType.upper()
                name = lyr.name.upper()
                sym = lyr.symbology

                try:
                    if sym.renderer.type == "SimpleRenderer":
                        if geom == "POLYGON":
                            color = polygon_rules.get(name, polygon_default)["color"]
                            sym.renderer.symbol.color = {'RGB': color}
                        elif geom == "POLYLINE":
                            rule = line_rules.get(name)
                            if rule:
                                sym.renderer.symbol.color = {'RGB': rule["color"]}
                                sym.renderer.symbol.width = rule["width"]
                        elif geom == "POINT":
                            rule = point_rules.get(name, point_default)
                            sym.renderer.symbol.color = {'RGB': rule["color"]}
                            sym.renderer.symbol.size = rule["size"]

                        lyr.symbology = sym

                except Exception as e:
                    arcpy.AddMessage("Symbology failed for: " + name)
                    arcpy.AddMessage(str(e))

        arcpy.AddMessage("Symbology updated.")
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jul 2025 19:04:57 GMT</pubDate>
    <dc:creator>ReneSoriano</dc:creator>
    <dc:date>2025-07-17T19:04:57Z</dc:date>
    <item>
      <title>Polyline line width not changing when specified in code for .pyt toolbox</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/polyline-line-width-not-changing-when-specified-in/m-p/1634006#M97330</link>
      <description>&lt;P&gt;I have this code that functionally works, it takes the layers i defined and then changes their colors and sizes and/or width. The problem I am encountering is that none of my polylines want to change width to 2, it keeps the default of 1, but their color is changing so I do not know why it is not doing it.&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

class Toolbox(object):
    def __init__(self):
        self.label = "SymbologyToolbox"
        self.alias = "SymbologyToolbox"
        self.tools = [SetSymbology]

class SetSymbology(object):
    def __init__(self):
        self.label = "Set Layer Symbology"
        self.description = "Applies color/size rules to layers in the active map."

    def getParameterInfo(self):
        return []

    def isLicensed(self):
        return True

    def updateParameters(self, parameters):
        return

    def updateMessages(self, parameters):
        return

    def execute(self, parameters, messages):
        aprx = arcpy.mp.ArcGISProject("CURRENT")
        map = aprx.activeMap
        arcpy.management.Delete("in_memory")

        point_rules = {
            "SECTION_CORNER": {"color": [115, 178, 255, 100], "size": 6},
        }
        point_default = {"color": [163, 255, 115, 100], "size": 5}

        polygon_rules = {
            "TOPO_HAZARD_PY": {"color": [221, 155, 255, 100]},
        }
        polygon_default = {"color": [255, 255, 190, 100]}

        line_rules = {
            "ROW_EDGES": {"color": [255, 0, 0, 100], "width": 2},
            "TOPO_HAZARD_LN": {"color": [255, 0, 0, 100], "width": 2},
            "ASB_ELECTRICAL": {"color": [85, 255, 0, 100], "width": 2},
            "ROW_ELECTRICAL": {"color": [85, 255, 0, 100], "width": 2},
            "TOPO_ELECTRICAL": {"color": [85, 255, 0, 100], "width": 2},
            "ASB_FIBERLINE": {"color": [255, 170, 0, 100], "width": 2},
            "ROW_FIBERLINE": {"color": [255, 170, 0, 100], "width": 2},
            "TOPO_FIBERLINE": {"color": [255, 170, 0, 100], "width": 2},
            "ASB_FLOWLINE": {"color": [255, 115, 223, 100], "width": 2},
            "ROW_FLOWLINE": {"color": [255, 115, 223, 100], "width": 2},
            "TOPO_FLOWLINE": {"color": [255, 115, 223, 100], "width": 2},
            "WELL_PATH_PLAN": {"color": [255, 115, 223, 100], "width": 2},
            "ASB_MULTIUSE": {"color": [0, 112, 255, 100], "width": 2},
            "ROW_MULTIUSE": {"color": [0, 112, 255, 100], "width": 2},
            "TOPO_MULTIUSE": {"color": [0, 112, 255, 100], "width": 2},
            "ASB_PIPELINE": {"color": [197, 0, 255, 100], "width": 2},
            "ROW_PIPELINE": {"color": [197, 0, 255, 100], "width": 2},
            "TOPO_PIPELINE": {"color": [197, 0, 255, 100], "width": 2},
            "ASB_ROAD": {"color": [255, 255, 0, 100], "width": 2},
            "ROW_ROAD": {"color": [255, 255, 0, 100], "width": 2},
            "TOPO_ROAD": {"color": [255, 255, 0, 100], "width": 2}
        }

        for lyr in map.listLayers():
            if lyr.isFeatureLayer:
                desc = arcpy.Describe(lyr)
                geom = desc.shapeType.upper()
                name = lyr.name.upper()
                sym = lyr.symbology

                try:
                    if sym.renderer.type == "SimpleRenderer":
                        if geom == "POLYGON":
                            color = polygon_rules.get(name, polygon_default)["color"]
                            sym.renderer.symbol.color = {'RGB': color}
                        elif geom == "POLYLINE":
                            rule = line_rules.get(name)
                            if rule:
                                sym.renderer.symbol.color = {'RGB': rule["color"]}
                                sym.renderer.symbol.width = rule["width"]
                        elif geom == "POINT":
                            rule = point_rules.get(name, point_default)
                            sym.renderer.symbol.color = {'RGB': rule["color"]}
                            sym.renderer.symbol.size = rule["size"]

                        lyr.symbology = sym

                except Exception as e:
                    arcpy.AddMessage("Symbology failed for: " + name)
                    arcpy.AddMessage(str(e))

        arcpy.AddMessage("Symbology updated.")
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jul 2025 19:04:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/polyline-line-width-not-changing-when-specified-in/m-p/1634006#M97330</guid>
      <dc:creator>ReneSoriano</dc:creator>
      <dc:date>2025-07-17T19:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Polyline line width not changing when specified in code for .pyt toolbox</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/polyline-line-width-not-changing-when-specified-in/m-p/1639372#M97886</link>
      <description>&lt;P&gt;If anyone has the same problem, I have already fixed it, I simply had to change this line of code from .width to .size I did not know that size also referred to how thick a line was.&lt;/P&gt;&lt;PRE&gt;sym.renderer.symbol.width = rule["width"]&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Aug 2025 19:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/polyline-line-width-not-changing-when-specified-in/m-p/1639372#M97886</guid>
      <dc:creator>ReneSoriano</dc:creator>
      <dc:date>2025-08-05T19:15:52Z</dc:date>
    </item>
  </channel>
</rss>

