Finding truly outer and inner trims of brep

Hi,

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.

Thanks
-Willem

Hi @Willem,

How about this:

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()
2 Likes

Hi Dale,

Thanks for your exmaple. Unfortunately it does not solve my issue.
Your example only finds the holes that do not run on multiple faces:
image

I’m looking for a way to also find the middle hole that runs over both faces.
See this file:
multiface_hole.3dm (36.8 KB)

Thanks
-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.

Unless you specify which ones are outer, I suppose. Then all the rest would inner.