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

Brep for Planar Rectangular Surface returns 5 edges

$
0
0

@MClare wrote:

I’m trying to get the edges of a planar surface that should be a rectangle, so I’m expecting a return of 4 edges. For some of the geometry I’m dealing with however, I’m getting 5 edges (my guess is due to a tolerance issue), which causes problems for the rest of my script. Is there a good way to “force” my brep to only have 4 edges (i.e. approximate as a rectangle if it is slightly off)?

strips = rs.ObjectsByLayer('CSA')
for strip in strips:
    # get only surfaces
    if rs.IsSurface(strip):
        if rs.IsSurfacePlanar(strip):
            strip_brep = rs.coercebrep(strip)
            edges = Rhino.Geometry.Brep.DuplicateEdgeCurves(strip_brep)
            print(len(edges))

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5743

Trending Articles