The Feature.MValueSet method sets the m-value of the specified vertex. It can overwrite an existing value.
Declaration
public bool Esri.ArcGISForAutoCAD.Feature.MValueSet(Document doc, ObjectId vertexObjectId, double mValue)
Parameters
| Type | Name | Description | Required |
|---|---|---|---|
Document | doc | The AutoCAD document to act on. | required |
ObjectId | vertexObjectId | The AutoCAD ObjectId of a Vertex2d or PolylineVertex3d that supports m-values. | required |
double | mValue | The new value for the vertex m-value. | required |
Returns
| Type | Description |
|---|---|
bool | true if the m-value was set successfully |
Remarks on error conditions
This method may throw an exception or return false or null if a parameter is invalid.
Example
Print the success of setting the m-values on the vertices of 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();
}
Polyline3d polyline = obj as Polyline3d;
double mValue = 2;
foreach (ObjectId vertexObjId in polyline)
{
mValue += .25;
// Set the M-Value
var success = Esri.ArcGISForAutoCAD.Feature.MValueSet(doc, vertexObjId, mValue);
// Print the success
doc.Editor.WriteMessage("\n" + success);
}
/* Example output
True
True
True
True
*/
See also
FeatureLayer.SelectEntity—A .NET method that prompts for the selection of one entity and returns its AutoCAD ObjectId.
esri_feature_SetMValue—An AutoLISP function that sets the m-value of a polyline vertex.