ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Core.Geometry Namespace / GeometryEngine Class / Cut Method
The polygon or polyline to cut.
The cutting line.
Example

In This Topic
    Cut Method (GeometryEngine)
    In This Topic
    Splits this geometry into parts. A polyline will be split into two parts at most.
    Syntax

    Parameters

    multipart
    The polygon or polyline to cut.
    cutter
    The cutting line.

    Return Value

    An IReadOnlyList<Geometry> representing the cut geometries.
    Exceptions
    ExceptionDescription
    Either multipart or cutter or both are null or empty.
    The method is not implemented for GeometryBag.
    Incompatible spatial references between the input geometries.
    Remarks
    When a polyline/polygon is cut, it is split where it intersects the cutter polyline. If a geometry is not cut, the returned IEnumerable<Geometry> will be empty.

    GeometryEngine Cut

    Example
    Cut a geometry with a polyline
    SpatialReference sr = SpatialReferences.WGS84;
    
    List<MapPoint> list = new List<MapPoint>();
    list.Add(MapPointBuilderEx.CreateMapPoint(1.0, 1.0, sr));
    list.Add(MapPointBuilderEx.CreateMapPoint(1.0, 4.0, sr));
    list.Add(MapPointBuilderEx.CreateMapPoint(4.0, 4.0, sr));
    list.Add(MapPointBuilderEx.CreateMapPoint(4.0, 1.0, sr));
    
    List<Geometry> cutGeometries;
    
    LineSegment line = LineBuilderEx.CreateLineSegment(MapPointBuilderEx.CreateMapPoint(0, 0, sr), MapPointBuilderEx.CreateMapPoint(3, 6, sr));
    Polyline cutter = PolylineBuilderEx.CreatePolyline(line);
    
    // polyline
    Polyline polyline = PolylineBuilderEx.CreatePolyline(list);
    bool isSimple = GeometryEngine.Instance.IsSimpleAsFeature(polyline);
    cutGeometries = GeometryEngine.Instance.Cut(polyline, cutter) as List<Geometry>;
    
    Polyline leftPolyline = cutGeometries[0] as Polyline;
    Polyline rightPolyline = cutGeometries[1] as Polyline;
    
    // leftPolyline.Points[0] = 1, 2
    // leftPolyline.Points[1] = 1, 4
    // leftPolyline.Points[2] = 2, 4
    
    // rightPolyline.Points.Count = 5
    // rightPolyline.Parts.Count = 2
    
    ReadOnlySegmentCollection segments0 = rightPolyline.Parts[0];
    // segments0[0].StartCoordinate = 1, 1
    // segments0[0].EndCoordinate = 1, 2
    
    ReadOnlySegmentCollection segments1 = rightPolyline.Parts[1];
    // segments1.Count = 2
    // segments1[0].StartCoordinate = 2, 4
    // segments1[0].EndCoordinate = 4, 4
    // segments1[1].StartCoordinate = 4, 4
    // segments1[1].EndCoordinate = 4, 1
    
    // polygon 
    Polygon polygon = PolygonBuilderEx.CreatePolygon(list);
    isSimple = GeometryEngine.Instance.IsSimpleAsFeature(polygon);
    cutGeometries = GeometryEngine.Instance.Cut(polygon, cutter) as List<Geometry>;
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also