ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Core Namespace / EditingOptions Class / GetSegmentSymbolOptions Method
Example

In This Topic
    GetSegmentSymbolOptions Method
    In This Topic
    Gets the segment sketching symbol information. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public SegmentSymbolOptions GetSegmentSymbolOptions()
    Public Function GetSegmentSymbolOptions() As SegmentSymbolOptions

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Get Sketch Segment Symbology Options
    //var options = ApplicationOptions.EditingOptions;
    QueuedTask.Run(() =>
    {
      var seg_options = options.GetSegmentSymbolOptions();
      //to convert the options to a symbol use
      //SymbolFactory. Note: this is approximate....sketch isn't using the
      //CIM directly for segments
      var layers = new List<CIMSymbolLayer>();
      var stroke0 = SymbolFactory.Instance.ConstructStroke(seg_options.PrimaryColor, 
        seg_options.Width, SimpleLineStyle.Dash);
      layers.Add(stroke0);
      if (seg_options.HasSecondaryColor) {
        var stroke1 = SymbolFactory.Instance.ConstructStroke(
          seg_options.SecondaryColor, seg_options.Width, SimpleLineStyle.Solid);
        layers.Add(stroke1);
      }
      //segment symbology only
      var sketch_line = new CIMLineSymbol() {
        SymbolLayers = layers.ToArray()
      };
    });
    Set Sketch Segment Symbol Options
    //var options = ApplicationOptions.EditingOptions;
    QueuedTask.Run(() =>
    {
      //change the segment symbol primary color to green and
      //width to 1 pt
      var segSymbol = options.GetSegmentSymbolOptions();
      segSymbol.PrimaryColor = ColorFactory.Instance.GreenRGB;
      segSymbol.Width = 1;
    
      //Are these valid?
      if (options.CanSetSegmentSymbolOptions(segSymbol)) {
        //apply them
        options.SetSegmentSymbolOptions(segSymbol);
              }
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also