Get a List of Faces Associated with Each Vertex in a Mesh

Hi everyone!
getFacesFromVertices.gh (20.9 KB)

I have this odd feeling of being stuck in something really stupid. I think once again data matching and trees are the problem.

I’m working with a mesh in Grasshopper, and I need to generate a Data Tree where:
:small_blue_diamond: Each branch corresponds to a vertex (its index is the {i} path).
:small_blue_diamond: Each branch contains the indices of the faces that include that vertex.

If I have a mesh with quadrilateral faces, I want to obtain something like this:

{0} → (0, 1, 3) # Vertex 0 belongs to faces 0, 1, and 3
{1} → (0, 2) # Vertex 1 belongs to faces 0 and 2
{2} → (1, 2, 4) # Vertex 2 belongs to faces 1, 2, and 4

probably there are easier ways…

getFacesFromVertices_re.gh (14.8 KB)

1 Like

that’s a good one. Thanks. I had a version myself involving (or rather abusing) create set and member index.
I’m not sure if you may be familiar to mesh modelling packages like Max or modo, where you are, say, in vertex mode and have some vertices selected and you move to poly mode. If you press a key while changing mode you can convert the selection. I wonder why there aren’t any components that do this directly. Thanks again!
Thanks again!

Vertex faces… Look here:

vertexfaces_c.gh (17.9 KB)

1 Like