Mesh.IsManifold returns true for non-manifold meshes

i’m trying to understand what exactly the output of Mesh.IsManifold means.
Therefore I have created a series of simple examples.

  1. closed mesh
  2. lid of the box is incorrectly oriented
  3. non-manifold edge
  4. lid of the box is missing

manifold_samples.3dm (45.8 KB)

The output of this script shows that all meshes are manifold=true.

import clr
import Rhino
import scriptcontext
import System.Guid
from Rhino import *
from Rhino.Geometry import *
from Rhino.DocObjects import *
from Rhino.Commands import *
from scriptcontext import doc
import System.Guid

def RunCommand():
  
    layername = scriptcontext.doc.Layers.CurrentLayer.Name
    
    # Get all of the objects on the layer. If layername is bogus, you will
    # just get an empty list back
    rhobjs = scriptcontext.doc.Objects.FindByLayer(layername)
    if not rhobjs: Rhino.Commands.Result.Cancel

    for obj in rhobjs:
        oriented = clr.StrongBox[bool]()
        boundary = clr.StrongBox[bool]()
        
        is_manifold = obj.Geometry.IsManifold(True, oriented, boundary) 
        out_oriented = str(oriented.Value)
        out_boundary = str(boundary.Value)
        print "IsManifold={0}, oriented={1}, hasBoundary={2}, isClosed={3}, isValid={4}".format( str(is_manifold), out_oriented, out_boundary, str(obj.Geometry.IsClosed), str(obj.Geometry.IsValid) )

    return Rhino.Commands.Result.Success


if __name__ == "__main__":
  RunCommand()

This is the output of the script:

IsManifold=True, oriented=True, hasBoundary=True, isClosed=True, isValid=True
IsManifold=True, oriented=True, hasBoundary=True, isClosed=True, isValid=True
IsManifold=True, oriented=True, hasBoundary=True, isClosed=False, isValid=True
IsManifold=True, oriented=True, hasBoundary=True, isClosed=False, isValid=True

What am I doing wrong?

Not sure you are doing anything wrong - this looks odd to me too. I wonder what other function Rhino is using to detect non-manifold edges - as Check and edge display both pick up the non-manifold edge correctly.

Many thanks for the confirmation. Looks like a bug. Is there a way to report a bug?

@dale can you check this? I didn’t want to make a bug item if we’re doing something wrong here and this is actually working but differently than we think…

HI @Helvetosaur,

Yes, I see this. I’ve started an issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-57038

– Dale