Get BrepLoops without overlapping curves

rhinocommon
python

#1

I try to get BrepLoops.To3dCurves without curves with are overlapping completly.

As example i have this image:

I have Brep “1” and with BrepLoops.To3dCurves i get “2” but i like to get “3”.
The curve i have removed in “3” are 2 Curves overlapping complet but are part of the same curve as “2”.

How could i get “3” with RhinoCommon and python?


#2

Hi @Felix1,

can you post the geometry so it can be verified if this is a seam at point 2 ?

Do you want to write a getter to prompt for only the selection of what is visible in point 3 or do you wand to input the geometry and output just what is visible in point 3 ?

_
c.


#3

I building a complex script at this is just a small part of it. I only need to store the curve from “3” into an variable to use it later in the script. I allready use a GetObject to pick the geometry and only need a function with brep,brepface or surface input and curve return.

I would need it as generic as possible because the geometrys could change a little bit.

I have attached the geometry: example.3dm (36.6 KB)


#4

Hi @Felix1, see if this is what you want, it seems to work on your example:

import Rhino
import scriptcontext
import rhinoscriptsyntax as rs
import math

def ExtractSharpEdgeCurves():
    
    brep_id = rs.GetObject("Select Brep", 16, True, False)
    if not brep_id: return
    
    brep = rs.coercebrep(brep_id, True)
    angle = math.radians(1.0)
    curves = []
    
    for edge in brep.Edges:
        if not edge.IsSmoothManifoldEdge(angle):
            curve = edge.DuplicateCurve()
            curves.append(curve)
        
    if not curves: return
    for crv in curves:
        crv_id = scriptcontext.doc.Objects.AddCurve(crv)
        rs.SelectObject(crv_id)
    
ExtractSharpEdgeCurves()

_
c.