﻿ SplitAtDistance Method—ArcGIS Pro
ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / MultipartBuilderEx Class / SplitAtDistance Method
The distance from the start point of the multipart to insert the vertex.
True to treat the distance as a ratio (or %) of the multipart length.
(Optional) Specifies whether a new part is to be created when the part is split. For polygons, it is always set to false. The default value is false.
Example

In This Topic
SplitAtDistance Method
In This Topic
Introduces a new vertex into the multipart at a specified distance from the beginning of the multipart. For a split to happen, the split distance must be between the start and end points of the multipart.
Syntax
```public int SplitAtDistance(
double distance,
bool asRatio,
bool createPart
)```
```Public Function SplitAtDistance( _
ByVal distance As Double, _
ByVal asRatio As Boolean, _
Optional ByVal createPart As Boolean _
) As Integer```

#### Parameters

distance
The distance from the start point of the multipart to insert the vertex.
asRatio
True to treat the distance as a ratio (or %) of the multipart length.
createPart
(Optional) Specifies whether a new part is to be created when the part is split. For polygons, it is always set to false. The default value is false.

#### Return Value

The absolute index of the segment that was split. It is not relative to the part. If the split didn't happen, -1 is returned.
Exceptions
ExceptionDescription
The distance is less than zero or is greater than the length of the multipart.
Remarks
createPart is ignored for polygons. For polylines, if createPart is true, the part on which the new split point falls is split into two parts.

Example
Split Polyline at distance
```// create list of points
MapPoint startPt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0);
MapPoint endPt = MapPointBuilderEx.CreateMapPoint(2.0, 1.0);

List<MapPoint> list = new List<MapPoint>() { startPt, endPt };

// BuilderEx constructors don't need to run on the MCT.

// use the PolylineBuilder as we wish to manipulate the geometry
// use AttributeFlags.None as we have 2D points
PolylineBuilderEx polylineBuilder = new PolylineBuilderEx(list, AttributeFlags.None);
// split at a distance 0.75
polylineBuilder.SplitAtDistance(0.75, false);
// get the polyline
Polyline polyline = polylineBuilder.ToGeometry();
// polyline should have 3 points  (1,1), (1.75, 1), (2,1)

MapPoint p1 = MapPointBuilderEx.CreateMapPoint(4.0, 1.0);
MapPoint p2 = MapPointBuilderEx.CreateMapPoint(6.0, 1.0);
MapPoint p3 = MapPointBuilderEx.CreateMapPoint(7.0, 1.0);
List<MapPoint> pts = new List<MapPoint>() { p1, p2, p3 };

polyline = polylineBuilder.ToGeometry();

// polyline has 2 parts. Each part has 3 points

// split the 2nd path half way - don't create a new path
polylineBuilder.SplitPartAtDistance(1, 0.5, true, false);

polyline = polylineBuilder.ToGeometry();

// polyline still has 2 parts; but now has 7 points
```
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3.1 or higher.