Get Mesh vertex index from Vertex coordinate

Hi there,

I know the x,y,z coordinate values of a mesh vertex and I want to find its index. I could not find any method on Rhinocommon to perform this operation.

Any suggestions would help greatly!


As what you have are just 3 known numbers, the only way to find the matching vertices is by testing equality of each vertex for the known point. Cast the xyz coordinates into a Rhino.Geometry.Point3d
and you could use this method to test for equality

Note that iirc there can be multiple vertices at the same location
Typically where 2 unwelded mesh faces meet they share the location of 2 vertices hower each face points to 2 different vertices.


Thanks for your suggestion Willems,

If I understood correctly you are explaining a way to find the coordinates of the mesh based on the known x,y,z points. But what I actually want to find is the vertex Index of a known mesh vertex coordinate.

Thank you for your time :slight_smile:

We might be miscommunicating,
Can you describe your desired solution in pseudo code?

My take was:

known_point = x,y,z
found_indices = []
for i, vertex in enumerate(MeshVertexList):
   if known_point.EpsilonEqualsTo(vertex):

Does that make sense?


See attached as well (and modify it accordingly: for instance by-pass the takePercent etc etc).

NOTE: MTV Indexing is NOT the same as MV Indexing.See inside C# for going from MTV idx to MV Idx (Array of indices in fact (*)… but anyway).

Tip: (*) Use always M.TopologyVertices [i.e. vertices **on a per Mesh** basis] instead of M.Vertices [i.e. **vertices on a per MeshFace** basis].

Tip: ALWAYS use the M.Vertices.CombineIdentical(true, true); Method. (160.9 KB)

Thank you so much for sharing a solution @Willem and @PeterFotiadis ! both work well