Intentionally create an invalid Brep/Mesh

I’m working on some helpers to ensure that my geometry remains valid throughout my pipeline. Does anyone know if

Brep.IsValid

is the exact same as evaluating

Brep.IsValidGeometry() && Brep.IsValidTolerancesAndFlags() && Brep.IsValidTopology()

Or does IsValid check some disjoint set of things?

Also, I need to validate my validity validators, which means it would be nice to be able to intentionally create a Brep and a Mesh which would return IsValid=false. In the case of Breps, it might be nice to be able to generate a fail on each of the 3 sub-tests. Anyone know how to reliably programmatically generate invalid geometries?

1 Like

For your two questions

  1. The source for OpenNurbs, bool ON_Brep::IsValid( ON_TextLog* text_log ) has quite a few checks. It doesn’t just call those other checks. That doesn’t necessarily mean it isn’t ultimately equivalent though.
    mcneel/opennurbs: OpenNURBS libraries allow anyone to read and write the 3DM file format without the need for Rhino. (github.com)

  2. I’d think the easiest way would be to save a valid 3DM file, sabotage it, and then read it in. The call stack doesn’t seem to indicate a check during file read but I could easily be wrong.