i’m trying to understand what exactly the output of Mesh.IsManifold means.
Therefore I have created a series of simple examples.
- closed mesh
- lid of the box is incorrectly oriented
- non-manifold edge
- 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?