Mesh Report Debug V0.gh (1.1 MB)
Hi, I am trying to learn C# scripting, and I’ve created a simple script that generates a mesh report. However, I’m encountering an issue—it doesn’t work with meshes that have no naked edges. I’ve spent hours trying to debug it, but I haven’t had good results.
Could you please help me identify the problem?
Thank you!
The error message shows:
- Object reference not set to an instance of an object. (line: 96)
string validText,closedText, manifoldText;
Boolean isOriented,hasBoundary;if (M.IsValid) { validText = "valid"; } else { validText = "not valid"; } if (M.IsClosed) { closedText = "closed"; } else { closedText = "not closed"; } if (M.IsManifold(true, out isOriented, out hasBoundary)) { manifoldText = "manifold"; } else { manifoldText = "not manifold"; } int nbDisjointPieces = M.DisjointMeshCount; int nNakedEdges = 0; Polyline [] plines = M.GetNakedEdges(); for (int i = 0; i < plines.Length; i++) { nNakedEdges += plines[i].Count - 1; } string meshReport = String.Format("Mesh is {0}, {1}, {2}. Mesh has {3} disjoint Pieces, {4} naked edges", validText, closedText, manifoldText, nbDisjointPieces, nNakedEdges); Report = meshReport;
4 posts - 2 participants