I’m about to write a python/RhinoCommon method to find inner and outer trims of a polysurface-brep.
The issue I need to solve is that Brep.DuplicateNakedEdgeCurves() is not sufficient in that it categorizes inner trims that run over multiple faces as outer naked edges:
Before I begin I’d like to ask if there is an existing way to identify all circles in this example as inner trims. Or if anybody has already solved this and likes to share.
import Rhino
import scriptcontext as sc
def test_willem():
filter = Rhino.DocObjects.ObjectType.PolysrfFilter
rc, objref = Rhino.Input.RhinoGet.GetOneObject("Select a polysurface", False, filter)
if not objref or rc != Rhino.Commands.Result.Success:
return
brep = objref.Brep()
if not brep:
return
for edge in brep.Edges:
if edge.Valence == Rhino.Geometry.EdgeAdjacency.Naked:
inner = False
for ti in edge.TrimIndices():
loop = brep.Trims[ti].Loop
if loop.LoopType == Rhino.Geometry.BrepLoopType.Inner:
sc.doc.Objects.AddCurve(edge.DuplicateCurve())
break
test_willem()
Unfortunately, there is no way to do this by tracing through a brep. In this picture, each object has two circular holes. As far as the brep topology is concerned, the two objects are equivalent. There is clearly no way to determine which is inner and which is outer in the cylinder, so there is also no way in the disk.