Hi community,
Is there a way to get mesh edges as index pairs? So given a mesh with triangle faces Q(0, 1, 2), Q(1, 2, 3) (so they share an edge)
I want pairs (0, 1) (0, 2) (1, 2) (1, 3) (2, 3) ––hopefully without repeating the (1, 2)
I have a big mesh with tens of thousands of vertices. I need to run function for each edge based on the value assigned to its vertices. (I have list of values in the same order as the vertices) So I try to get all edges with mesh edges. Then I get the end points, which are vertices in the original mesh. But due to GH’s workings, I need the ‘member index’ to search all the vertices, in order to get the index for these end points to get their values. This gets GH stuck.
Thanks a lot!
In case you’re on Rhino 8, you can use the script inside this definition. It outputs the mesh topology indices. There are other similar scripts somewhere in this forum.
unweld_mesh_edge_01_c.gh (16.6 KB)
1 Like
Thanks very much for your help Martin!
Your script is great but seem to differ from what I need–for each edge, get the index of its start and end points
So given a mesh with triangle faces Q(0, 1, 2), Q(1, 2, 3) (so they share an edge)
I want pairs (0, 1) (0, 2) (1, 2) (1, 3) (2, 3) ––hopefully without repeating the (1, 2)
You can do this with a native Kangaroo component called ‘HingePoints’
1 and 2 are the end points of each edge.
1 Like
If the value on edge is the mean value of the weight on the 2 vertex, Nautilus has a small tool to do that
1 Like
Thanks a lot for your help Laurent and Martin! Following the Mesh-topology-edges trail in Martin’s code, I found Laurent’s code here Mesh.TopologyEdges - #4 by laurent_delrieu. That helped me figure out my problem. Sorry for the confusion, and thanks again for your patience and guidance
I didn’t search. Here quite the same code but with a datatree
mesh topology edge.gh (151.3 KB)
1 Like