<?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: How to add symbol and symbol layers? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-add-symbol-and-symbol-layers/m-p/1387626#M11157</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you looking to add a new class break to a Unique Value renderer? If so, here is a code snippet:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().FirstOrDefault();
 if (layer == null)
   return;
 QueuedTask.Run( () =&amp;gt; { 
    var uvr = layer.GetRenderer() as CIMUniqueValueRenderer;
   if (uvr == null)
       return;
   var cimUniqueValueGroup = uvr.Groups[0] as CIMUniqueValueGroup;
   var classes = cimUniqueValueGroup.Classes;
   var cimUniqueValueClass = new CIMUniqueValueClass();
   cimUniqueValueClass.Label = "New Value";
   var lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.RedRGB, 2.0, SimpleLineStyle.Solid) ;
   lineSymbol.UseRealWorldSymbolSizes = false;
   cimUniqueValueClass.Symbol = lineSymbol.MakeSymbolReference();

   #region New value to the class
   var cimUniqueValues = new List&amp;lt;CIMUniqueValue&amp;gt;();
   var cimUniqueValue = new CIMUniqueValue() { FieldValues = new string[] { "New Value" } };
   cimUniqueValues.Add(cimUniqueValue);
   #endregion
   cimUniqueValueClass.Values = cimUniqueValues.ToArray();
   cimUniqueValueClass.Visible = true;
   var classesList = classes.ToList();
   classesList.Add(cimUniqueValueClass);
   cimUniqueValueGroup.Classes = classesList.ToArray();
   uvr.Groups[0] = cimUniqueValueGroup;
   layer.SetRenderer(uvr);
 });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding your second question, if you are looking to add a new Symbol layer to an existing symbol, this is the code snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().FirstOrDefault( s =&amp;gt; s.ShapeType == esriGeometryType.esriGeometryPolyline);
QueuedTask.Run( () =&amp;gt; { 
   var simpleRenderer = layer.GetRenderer() as CIMSimpleRenderer;
   var lineSymbol = simpleRenderer.Symbol.Symbol as CIMLineSymbol;
  if (lineSymbol == null)
        return;
  var layers = lineSymbol.SymbolLayers;
  var solidStroke = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.RedRGB, 2.0, SimpleLineStyle.Solid);
  var offSetEffect = new CIMGeometricEffectOffset()
  {
    Method = GeometricEffectOffsetMethod.Rounded,
    Offset = 3,
    Option = GeometricEffectOffsetOption.Fast
  };
  solidStroke.Effects = new CIMGeometricEffect[] { offSetEffect };
  var layersList = layers.ToList();
  layersList.Add(solidStroke);
  lineSymbol.SymbolLayers = layersList.ToArray();
  simpleRenderer.Symbol = lineSymbol.MakeSymbolReference();
  layer.SetRenderer(simpleRenderer);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2024 18:49:54 GMT</pubDate>
    <dc:creator>UmaHarano</dc:creator>
    <dc:date>2024-02-27T18:49:54Z</dc:date>
    <item>
      <title>How to add symbol and symbol layers?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-add-symbol-and-symbol-layers/m-p/1386414#M11145</link>
      <description>&lt;P&gt;Frm &lt;A href="https://github.com/Esri/cim-spec/blob/main/docs/v3/Overview-Symbols.md" target="_blank" rel="noopener"&gt;cim-spec/docs/v3/Overview-Symbols.md at main · Esri/cim-spec (github.com)&lt;/A&gt;, I can read the number and properties of symbol and symbol layers. However, how to add a symbol or symbol layer of an existing symbolic system in a layer with SDK?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 05:47:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-add-symbol-and-symbol-layers/m-p/1386414#M11145</guid>
      <dc:creator>HaoWong</dc:creator>
      <dc:date>2024-02-25T05:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to add symbol and symbol layers?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-add-symbol-and-symbol-layers/m-p/1386418#M11146</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20240224102317.png" style="width: 407px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95741iE169F969D1C7FA34/image-size/large?v=v2&amp;amp;px=999" role="button" title="20240224102317.png" alt="20240224102317.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For example, if there is a symbol system represented by a unique value, I programmed a &lt;STRONG&gt;CIMLineSymbol&lt;/STRONG&gt; variable. How to add it and generate a new line in this table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20240224102337.png" style="width: 409px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/95742i69428662D207AC91/image-size/large?v=v2&amp;amp;px=999" role="button" title="20240224102337.png" alt="20240224102337.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Also, when I programmed a &lt;STRONG&gt;CIMSymbolLayer&lt;/STRONG&gt; variable, how to add it to the above table as a new line?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2024 05:47:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-add-symbol-and-symbol-layers/m-p/1386418#M11146</guid>
      <dc:creator>HaoWong</dc:creator>
      <dc:date>2024-02-25T05:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to add symbol and symbol layers?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-add-symbol-and-symbol-layers/m-p/1387626#M11157</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you looking to add a new class break to a Unique Value renderer? If so, here is a code snippet:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().FirstOrDefault();
 if (layer == null)
   return;
 QueuedTask.Run( () =&amp;gt; { 
    var uvr = layer.GetRenderer() as CIMUniqueValueRenderer;
   if (uvr == null)
       return;
   var cimUniqueValueGroup = uvr.Groups[0] as CIMUniqueValueGroup;
   var classes = cimUniqueValueGroup.Classes;
   var cimUniqueValueClass = new CIMUniqueValueClass();
   cimUniqueValueClass.Label = "New Value";
   var lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.RedRGB, 2.0, SimpleLineStyle.Solid) ;
   lineSymbol.UseRealWorldSymbolSizes = false;
   cimUniqueValueClass.Symbol = lineSymbol.MakeSymbolReference();

   #region New value to the class
   var cimUniqueValues = new List&amp;lt;CIMUniqueValue&amp;gt;();
   var cimUniqueValue = new CIMUniqueValue() { FieldValues = new string[] { "New Value" } };
   cimUniqueValues.Add(cimUniqueValue);
   #endregion
   cimUniqueValueClass.Values = cimUniqueValues.ToArray();
   cimUniqueValueClass.Visible = true;
   var classesList = classes.ToList();
   classesList.Add(cimUniqueValueClass);
   cimUniqueValueGroup.Classes = classesList.ToArray();
   uvr.Groups[0] = cimUniqueValueGroup;
   layer.SetRenderer(uvr);
 });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regarding your second question, if you are looking to add a new Symbol layer to an existing symbol, this is the code snippet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;var layer = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().FirstOrDefault( s =&amp;gt; s.ShapeType == esriGeometryType.esriGeometryPolyline);
QueuedTask.Run( () =&amp;gt; { 
   var simpleRenderer = layer.GetRenderer() as CIMSimpleRenderer;
   var lineSymbol = simpleRenderer.Symbol.Symbol as CIMLineSymbol;
  if (lineSymbol == null)
        return;
  var layers = lineSymbol.SymbolLayers;
  var solidStroke = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.RedRGB, 2.0, SimpleLineStyle.Solid);
  var offSetEffect = new CIMGeometricEffectOffset()
  {
    Method = GeometricEffectOffsetMethod.Rounded,
    Offset = 3,
    Option = GeometricEffectOffsetOption.Fast
  };
  solidStroke.Effects = new CIMGeometricEffect[] { offSetEffect };
  var layersList = layers.ToList();
  layersList.Add(solidStroke);
  lineSymbol.SymbolLayers = layersList.ToArray();
  simpleRenderer.Symbol = lineSymbol.MakeSymbolReference();
  layer.SetRenderer(simpleRenderer);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 18:49:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-add-symbol-and-symbol-layers/m-p/1387626#M11157</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2024-02-27T18:49:54Z</dc:date>
    </item>
  </channel>
</rss>

