Finding truly outer and inner trims of brep


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.


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: 
    brep = objref.Brep()
    if not brep:
    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:

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:

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)


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.