ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / GetSubCurve Method
The multipart from which the subcurve will be extracted.
The distance along the multipart to start the subcurve.
The distance along the multipart to end the subcurve.
Indicates whether the fromDistance and toDistance are given as lengths or ratios along the multipart.
Example

In This Topic
    GetSubCurve Method (GeometryEngine)
    In This Topic
    Gets the subcurve of the input multipart between fromDistance and toDistance.
    Syntax

    Parameters

    multipart
    The multipart from which the subcurve will be extracted.
    fromDistance
    The distance along the multipart to start the subcurve.
    toDistance
    The distance along the multipart to end the subcurve.
    asRatioOrLength
    Indicates whether the fromDistance and toDistance are given as lengths or ratios along the multipart.

    Return Value

    The polyline representing the subcurve. If the input multipart is empty, then an empty polyline is returned.
    Exceptions
    ExceptionDescription
    Multipart is null.
    Example
    Get Sub-curve of a polyline or polygon
    SpatialReference sr = SpatialReferences.WGS84;
    
    List<Coordinate2D> coords = new List<Coordinate2D>()
    {
      new Coordinate2D(-111, 72),
      new Coordinate2D(-108, 68),
      new Coordinate2D(-114, 68)
    };
    
    Polyline polyline = PolylineBuilderEx.CreatePolyline(coords, sr);
    
    Polyline subCurve = GeometryEngine.Instance.GetSubCurve(polyline, 0, 5, AsRatioOrLength.AsLength);
    // subCurve.PartCount = 1
    // subCurve.PointCount = 2
    
    ReadOnlyPointCollection points = subCurve.Points;
    // points[0] = -111, 72
    // points[1] = -108, 68
    
    subCurve = GeometryEngine.Instance.GetSubCurve(polyline, 0, 0.5, AsRatioOrLength.AsRatio);
    // subCurve.PointCount = 3
    
    points = subCurve.Points;
    // points[0] = -111, 72
    // points[1] = -108, 68
    // points[2] = -108.5, 68
    
    
    List<Coordinate3D> coords3D = new List<Coordinate3D>()
    {
      new Coordinate3D(0, 0, 0),
      new Coordinate3D(0, 1, 1),
      new Coordinate3D(1, 1, 2),
      new Coordinate3D(1, 0, 3)
    };
    
    Polygon polygon = PolygonBuilderEx.CreatePolygon(coords3D, sr);
    
    subCurve = GeometryEngine.Instance.GetSubCurve3D(polygon, 0, 1, AsRatioOrLength.AsLength);
    // subCurve.HasZ = true
    
    points = subCurve.Points;
    // points.Count = 2
    // points[0] = 0, 0, 0
    // points[1] = 0, 0.70710678118654746, 0.70710678118654746
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also