Hello,
I’m trying to retrieve vertex index when I move a mesh node. I can trap the RhinoDoc_ReplaceObject event and grab mesh objects. However, the componentIndex does not give a valid number. I’m using R8 and I vaguely remember componentIndex worked fine in R7.
Thanks
private void RhinoDoc_ReplaceObject(object sender, RhinoReplaceObjectEventArgs e)
{
// This method is called whenever an object is replaced in the Rhino document.
// Access event arguments:
RhinoObject oldObject = e.OldRhinoObject; // The object that was replaced
RhinoObject newObject = e.NewRhinoObject; // The replacement object
// Perform actions based on the event:
if (oldObject != newObject && oldObject.ObjectType == ObjectType.Mesh && newObject.ObjectType == ObjectType.Mesh)
{
Mesh mesh_old = oldObject.Geometry as Mesh;
int vertexidx_old = oldObject.Geometry.ComponentIndex().Index;
ComponentIndexType indexType = mesh_old.ComponentIndex().ComponentIndexType;
Mesh mesh_new = newObject.Geometry as Mesh;
int vertexidx_new = newObject.Geometry.ComponentIndex().Index;
ComponentIndexType indexType_new = mesh_new.ComponentIndex().ComponentIndexType;