Skip To Content

Feature.MValueGet (.NET)

The Feature.MValueGet method returns the m-value of the specified vertex.

Declaration

public double? Esri.ArcGISForAutoCAD.Feature.MValueGet(Document doc, ObjectId vertexObjectId)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

ObjectId

vertexObjectId

The AutoCAD ObjectId of a Vertex2d or PolylineVertex3d that supports m-values.

required

Returns

TypeDescription

double?

The m-value of the vertex. If the m-value has not been set on a vertex, its m-value will return as 0.

Remarks on error conditions

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

Example

Print the m-value of each vertex in the selected polyline.

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

DBObject obj;
using (var transaction = doc.Database.TransactionManager.StartTransaction())
{
  obj = transaction.GetObject(polylineObjId, OpenMode.ForRead);
  transaction.Commit();
}

Polyline2d polyline = obj as Polyline2d;
foreach (ObjectId vertexObjId in polyline)
{
  // Get the M-Value
  var mValue = Esri.ArcGISForAutoCAD.Feature.MValueGet(doc, vertexObjId);

  // Print the M-Value
  doc.Editor.WriteMessage("\nM-Value: " + mValue);
}

/* Example output 
M-Value: 28.4
M-Value: 32.1
M-Value: 32.6
M-Value: 34.5
*/

See also

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

esri_feature_GetMValue—An AutoLISP function that returns the m-value of a feature vertex.