Skip To Content

Feature.MValues (.NET)

The Feature.MValues method returns the m-values of the given polyline as a dictionary in which the keys are the vertex ObjectIds.

Declaration

public Dictionary<ObjectId, double> Esri.ArcGISForAutoCAD.Feature.MValues(Document doc, ObjectId polylineObjectId)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

ObjectId

polylineObjectId

The AutoCAD ObjectId of a Polyline2d or Polyline3d that supports m-values.

required

Returns

TypeDescription

Dictionary<ObjectId, double>

A dictionary of polyline vertex ObjectIds and their m-values. If the m-value has not been set on a vertex, its m-value will return as 0. Key: Polyline vertex ObjectId, Value: M-Value.

Remarks on error conditions

This method may throw an exception or return null if a parameter is invalid.

Example

Print the m-value and AutoCAD ObjectId from each vertex of the selected feature.

// Initialize 
var doc = Application.DocumentManager.MdiActiveDocument;
var polylineObjId = Esri.ArcGISForAutoCAD.FeatureLayer.SelectEntity(doc, "Centerlines");

// Get the M-Values
var mValues = Esri.ArcGISForAutoCAD.Feature.MValues(doc, polylineObjId);

// Print the M-Values
foreach (var mValue in mValues)
{
  doc.Editor.WriteMessage("\nObjectId: {0}, M-Value: {1}", mValue.Key, mValue.Value);
}

/* Example output 
ObjectId: (2347729642896), M-Value: 0.75
ObjectId: (2347729642912), M-Value: 1.34
ObjectId: (2347729642928), M-Value: 1.26
ObjectId: (2347729642944), M-Value: 0.55
*/

See also

FeatureLayer.SelectEntity—A .NET method that prompts for the selection of one entity and returns its AutoCAD ObjectId.

esri_feature_MValues—An AutoLISP function that returns an associated list of vertex subentity names and m-values as an associated list.