DocumentCollectedException in Mesh.CreateFromBrep

I’ve got a call to Mesh.CreateFromBrep that’s throwing a DocumentCollectedException. The Brep is document controlled, but given that the example code for Mesh.CreateFromBrep is called with a document-controlled Brep, that doesn’t seem like it should be a problem.

Also, when I try to inspect the Brep with the Visual Studio debugger, a whole bunch of its property getters (including but not limited to IsSolid, IsSurface, and IsManifold) also throw DocumentCollectedExceptions, which seems weird to me.

Does anyone know what could be going on here?

Sounds like the parent BrepObject was deleted from the document at some point. Are you holding on the the Brep between commands?

No, but investigating that led me to what I assume is the problem. The Brep came not from a BrepObject, but a call to Brep.TryConvertBrep that was passed a Curve that didn’t have a proper Brep form. Apparently, rather than just returning null, Brep.TryConvertBrep returned a garbage Brep that couldn’t be used for anything. Should this be happening?

3 posts were split to a new topic: Brep.TryConvertBrep returns invalid Brep