ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Editing Namespace / EditOperation Class / CreateTraverse Method
The traverse to create features for.
The template to create features with.
The user defined attributes to assign to the new rows. The attributes will be assigned to each feature created.
Example

In This Topic
    CreateTraverse Method
    In This Topic
    Creates features using the traverse courses and the specified feature template. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    traverse
    The traverse to create features for.
    featureTemplate
    The template to create features with.
    values
    The user defined attributes to assign to the new rows. The attributes will be assigned to each feature created.
    Exceptions
    ExceptionDescription
    The traverse or feature template is null.
    Features cannot be created for the current traverse using the specified template.
    An error occurred in the edit operation.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    Use CanCreateTraverse to determine if the traverse is valid and features can be created with the specified template prior to calling this method.

    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