Add mesh to document even if invalid

In the process of creating/repairing meshes, at some point Mesh.MatchEdges() can produce an invalid mesh. If this happens, trying to add it to the document via scriptcontext.doc.Objects.AddMesh(mesh) fails.

If I add the mesh to the document before MatchEdges() and then run the Rhino command MatchMeshEdges on it, it produces the bad object as well - but at least I have it in the document and can do something with it. Any way to get an invalid mesh added to the document via RhinoCommon?

1 Like

Hi @Helvetosaur,

There is CheckNewObjects.

– Dale

Also, there is an overload when adding a mesh that has a boolean requireValidMesh. This can be set to false, and other variables can (probably) be set to null/None.

2 Likes

Doesn’t help when the geometry is virtual (RhinoCommon) and can’t be added to the document by scriptcontext…

That’s it, thanks!!

I guess I was thinking of RhinoScript’s CheckNewObjects method…

– Dale