Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5892

Get unique mesh edges in GHPython with rhinocommon?

$
0
0

@p1r4t3b0y wrote:

Hi,

Is there a way to get the unique mesh edges in rhinocommon, without duplicate edges.
I currently construct the mesh edges for each face, from the face vertices.

result = list(my_mesh.Faces.GetFaceVertices(my_index))
edges = []
if result[0]: # success
    vertices = list(result[1:])
    for i in range(len(vertices)):
        if i < len(vertices) - 1:
            edge = rg.LineCurve(vertices[i], vertices[i+1])
        else:
            edge = rg.LineCurve(vertices[i], vertices[0])
        edges.append(edge)

However, this is problematic, since it produces a duplicate edge/line for each face edge that has a neighbour. I would prefer to construct each shared edge only once.

Any suggestions?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5892

Trending Articles