ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / MultipartBuilderEx Class / RemoveSegment Method
Zero-based index. Specify 0 to remove a segment from the first part. Specify PartCount - 1 or -1 to remove a segment from the last part.
Zero-based index. Specify 0 to remove the first segment. Specify GetSegmentCount - 1 or -1 to remove the last segment.
Specifies if the gap left by the removed segment should be closed to create a connected part. It applies only to interior segments. In other words, if the first or last segment is removed, the closeGap argument is ignored.

In This Topic
    RemoveSegment Method
    In This Topic
    Remove the segment at the specified index from the part specified by partIndex.
    Syntax
    public void RemoveSegment( 
       int partIndex,
       int segmentIndex,
       bool closeGap
    )
    Public Sub RemoveSegment( _
       ByVal partIndex As Integer, _
       ByVal segmentIndex As Integer, _
       ByVal closeGap As Boolean _
    ) 

    Parameters

    partIndex
    Zero-based index. Specify 0 to remove a segment from the first part. Specify PartCount - 1 or -1 to remove a segment from the last part.
    segmentIndex
    Zero-based index. Specify 0 to remove the first segment. Specify GetSegmentCount - 1 or -1 to remove the last segment.
    closeGap
    Specifies if the gap left by the removed segment should be closed to create a connected part. It applies only to interior segments. In other words, if the first or last segment is removed, the closeGap argument is ignored.
    Exceptions
    ExceptionDescription
    The input part index is > PartCount - 1 or the input segment index is > GetSegmentCount - 1.
    The segment before the removed segment is an EllipticArcSegment, closeGap = true, and the start point of the segment after the removed segment is not on the embedded circle or ellipse. See EllipticArcBuilderEx.StartPoint.
    Remarks
    If the removed segment leaves a gap and closeGap = true, then some end points may change. The end point of the segment before the removed segment will be moved to the start point of the segment after the removed segment. For example, suppose your PolylineBuilderEx has the three segments shown below. Remove Segment You call RemoveSegment(0, 1, true) to remove Segment 1 from Part 0 and fill the gap. The end point of Segment 0 in the resulting polyline has been moved to coincide with the start point of Segment 1. Remove Segment

    If the segment before the removed segment is an EllipticArcSegment and the start point of the segment after the removed segment is not on the embedded circle or ellipse, then an exception is thrown. Also note that if there is a gap between segments in the same part when calling PolylineBuilderEx.ToGeometry or PolygonBuilderEx.ToGeometry, then the gap will be filled in with a line segment.

    See ReplaceSegment to replace a segment.

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also