Hello all,
We’ve got imported objects which are creating some bad geometries - these objects are all coming out as Closed and Valid but we need to catch these so they can be remodelled before they cause issues later on. I see that once I try to mesh these geometries I get at least some errors that I can start catching, but overall I’m wondering if there is a better workflow to catch these - these are all coming from separate files and ideally we need to be able to generate a spreadsheet that alerts us to where the erroneous files are.
I’m wondering if:
- Is there some mysterious command to catch these while they are still Breps?
- I can see that there is a Mesh.Check() method but I can’t seem to call it on any of my meshes or statically? (pretty generic errors of no definition or method)
- The created mesh is coming back as Closed and Valid from this, I see there is MeshFaces.GetZeroAreaFaces() and MeshFaces.GetClashingFacePairs() which I’m guessing could pick up intersecting faces and degenerate faces, but it feels a bit cumbersome - is there a better way?
Also is there then a way to catch the differing MeshNormals, I see there is a Mesh.UnifyNormals() method, but if it fails to reorder the vertices or otherwise fails, how do I actually catch the different face directions? (again, I don’t actually need to repair the mesh here, I just need to flag it up so it can be fixed in the original brep file, is there a reliable way to find out which meshes are broken?)
private void RunScript(Brep x, object y, ref object A, ref object B)
{
Mesh[] msh = Mesh.CreateFromBrep(x, MeshingParameters.FastRenderMesh);
Mesh rtnMesh = new Mesh();
for(int i = 0; i < msh.Length; i++)
{
rtnMesh.Append(msh[i]);
}
Print(rtnMesh.IsValid.ToString() + rtnMesh.IsClosed.ToString());
//this comes back as Valid and Solid despite the clear issues in the file
A = rtnMesh;
}
Many thanks,
Sash