C++ Select Mesh Vertices

I am following this tutorial by @dale , but it seems to be outdated: Moving Mesh Vertices with C/C++ (rhino3d.com)
What is the right way to select multiple mesh vertices?

I tried to change that to this, but there is no casting to meshvertex:

You probably need to get the MeshComponentRef from the object reference like so:

const ON_MeshComponentRef* mcRef = gv.Object(0).MeshComponentRef();

https://developer.rhino3d.com/api/cpp/class_c_rhino_obj_ref.html

https://developer.rhino3d.com/api/cpp/class_o_n___mesh_component_ref.html

Then, in that reference you have access to the type of component (vertex) the mesh and the index of the selected vertex in the vertices array.

2 Likes

Worked, thank you very much.

Id can be retrieved like this:
int id = mcRef->VertexIndex();

1 Like