ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Editing.COGO Namespace / Course Class / ObjectID Property
Example

In This Topic
    ObjectID Property (Course)
    In This Topic
    Gets the ObjectID for the feature created for the course. This is populated only after CreateTraverse has been called for the traverse.
    Syntax
    Public ReadOnly Property ObjectID As Long
    public long ObjectID {get;}

    Property Value

    ObjectID for the course feature. -1 if no feature has been created for the traverse course.
    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