ArcGIS Pro 2.7 API Reference Guide
SetMsAsDistance Method (IGeometryEngine)
Example 

ArcGIS.Core.Geometry Namespace > IGeometryEngine Interface : SetMsAsDistance Method
The multipart in which to set the M values.
Indicates whether the M values are set as lengths or ratios along the multipart.
Sets the M values to the cumulative length from the start of the multipart.
Syntax

Parameters

multipart
The multipart in which to set the M values.
asRatioOrLength
Indicates whether the M values are set as lengths or ratios along the multipart.

Return Value

Multipart with M values set.
Exceptions
ExceptionDescription
Multipart is null or empty.
This geometry is not M-Aware.
Spatial reference of multipartis an image coordinate system.
Example
string json = "{\"hasM\":true,\"rings\":[[[0,0],[0,3000],[4000,3000],[4000,0],[0,0]]],\"spatialReference\":{\"wkid\":3857}}";
Polygon polygon = PolygonBuilder.FromJson(json);

Polygon outPolygon = GeometryEngine.Instance.SetMsAsDistance(polygon, AsRatioOrLength.AsLength) as Polygon;
ReadOnlyPointCollection outPoints = outPolygon.Points;
// outPoints M values are { 0, 3000, 7000, 10000, 14000 };
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

IGeometryEngine Interface
IGeometryEngine Members