ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / CanCreateTraverse Method
The traverse to create features for.
The template to create features with.
Example

In This Topic
    CanCreateTraverse Method
    In This Topic
    Determines if the features can be created for the traverse using the specified template.
    Syntax
    Public Function CanCreateTraverse( _
       ByVal traverse As Traverse, _
       ByVal featureTemplate As EditingTemplate _
    ) As Boolean
    public bool CanCreateTraverse( 
       Traverse traverse,
       EditingTemplate featureTemplate
    )

    Parameters

    traverse
    The traverse to create features for.
    featureTemplate
    The template to create features with.

    Return Value

    True if features can be created for the traverse using the specified template.
    Remarks
    It is important to call this method prior to CreateTraverse to ensure that the traverse is well defined and the template specified is valid.

    The traverse is well defined if the following is true - there must be at least 1 courses in the traverse; the first course cannot be defined by a tangent curve or an angle/distance line. In addition in order to create valid features, the traverse should also have a ArcGIS.Desktop.Editing.COGO.Traverse.StartPoint defined.

    Only polyline or polygon templates can be used to create features.

    Note that if this method returns true it does not preclude the CreateTraverse method from erroring due to a calculation error and callers should code defensively and use appropriate exception handling.
    Example
    Create Features
    var layerName = "Lot_Lines"; //Name of the COGO enabled line layer in the map
    var fLayer = MapView.Active?.Map?.GetLayersAsFlattenedList().OfType<FeatureLayer>().Where(l => l.
              Name.Equals(layerName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
    var templateLotLines = fLayer.GetTemplates().FirstOrDefault(); //get the feature template
    
    var editOper = new EditOperation
    {
      Name = "Create Traverse",
      SelectNewFeatures = false
    };
    
    var dirOffset = g2gCorrection.GetDirectionOffset();
    var scaleFactor = g2gCorrection.GetConstantScaleFactor();
    var dictAttributes = new Dictionary<string, object>();
    dictAttributes["Rotation"] = dirOffset;
    dictAttributes["Scale"] = scaleFactor;
    if (editOper.CanCreateTraverse(travParcel, templateLotLines))
    {
      await editOper.CreateTraverse(travParcel, templateLotLines, dictAttributes);
    }
    
    if (!editOper.IsEmpty)
    {
      editOper.Execute();
    
      // access the mapMember, OID for each created feature 
      foreach (var course in travParcel.Courses)
      {
        var mapMember = course.MapMember;
        var oid = course.ObjectID;
    
        var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector();
        insp.Load(mapMember, oid);
        var shape = insp.Shape;
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.7 or higher.
    See Also