ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Editing.COGO Namespace / COGOLine Class / Distance Property
Example

In This Topic
    Distance Property (COGOLine)
    In This Topic
    Gets the distance value. If IsStraightLine, then this is the distance between end points of the line. If IsCircularArc, then this is the distance along the chord line between the end points.
    Syntax
    Public ReadOnly Property Distance As Nullable(Of Double)
    public Nullable<double> Distance {get;}
    Example
    Get COGOLine parameter information
    if (cogoLine.IsStraightLine)
    {
      var dist = cogoLine.Distance;
      var dir = cogoLine.Direction;
    }
    else if (cogoLine.IsCircularArc)
    {
      var circArcDefinition = cogoLine.ToCircularArcDefinition();
      string s = "";
    
      //show Arc length, either entered or calculated
      if (circArcDefinition.IsDefinedByArcLength) 
      {
        if (circArcDefinition.ArcLength.HasValue)
        {
          s += "<entered> Arc Length: " + circArcDefinition.ArcLength.Value.ToString("F3")
            + Environment.NewLine;
        }
      }
      else
      {
        if (circArcDefinition.CanCalculateArcLength())
        {
          s += "<calc> Arc Length: " + circArcDefinition.CalculateArcLength().ToString("F3")
               + Environment.NewLine;
        }
        else
          s += "<calc> not able to calc arc length." + Environment.NewLine;
      }
    
      // chordLength
      if (circArcDefinition.IsDefinedByChordLength)
      {
        if (circArcDefinition.ChordLength.HasValue)
        {
          s += "<entered> Chord Length: " + circArcDefinition.ChordLength.Value.ToString("F3")
            + Environment.NewLine;
        }
      }
      else
      {
        if (circArcDefinition.CanCalculateChordLength())
        {
          s += "<calc> Chord Length: " + circArcDefinition.CalculateChordLength().ToString("F3")
               + Environment.NewLine;
        }
        else
          s += "<calc> not able to calc chord length." + Environment.NewLine;
      }
    
      // central Angle
      if (circArcDefinition.IsDefinedByCentralAngle)
      {
        if (circArcDefinition.CentralAngle.HasValue)
        {
          s += "<entered> Central Angle: " + circArcDefinition.CentralAngle.Value.ToString("F3")
            + Environment.NewLine;
        }
      }
      else
      {
        if (circArcDefinition.CanCalculateCentralAngle())
        {
          s += "<calc> Central Angle: " + circArcDefinition.CalculateCentralAngle().ToString("F3")
               + Environment.NewLine;
        }
        else
          s += "<calc> not able to calc Central Angle." + Environment.NewLine;
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.7 or higher.
    See Also