My plugin is converting breps into meshes but sometimes it just fails. In such cases the CreateFromBrep just hangs on this line and it never goes further. I was using different meshing parameters but nothing seem to be working. Attached is also the test model which is failing.
Let me add that I’m using Rhinoceros 8 while in Rhinoceros 6 I had no such problems.
So the example can be as simple as this and it will fail for the geometry I have attached in first post.
The coordinates system is always set to World. I’m not sure if you ask me to set it also programmatically?
Result Run(RhinoDoc doc)
{
var go = new GetObject();
go.SetCommandPrompt("Select...");
go.GetMultiple(1, 0);
if (go.CommandResult() != Result.Success)
return go.CommandResult();
DocObjects.ObjRef[] objRefs = go.Objects();
if (objRefs == null)
return Result.Nothing;
while (true)
{
GetResult gr = gi.Get();
if (gr == GetResult.Cancel)
break;
}
var shape = objRefs[0].Geometry() as Brep;
MeshingParameters mp = new MeshingParameters();
mp.RelativeTolerance = 0; // Density
mp.GridAngle = RhinoMath.ToRadians(5); // maximum angle
mp.GridAspectRatio = 3; // Maximum aspect ratio
mp.MinimumEdgeLength = 1; // Minimum Edge Length
mp.MaximumEdgeLength = 5; // Maximum Edge Length
mp.Tolerance = 0.1; // Max distance, edge to surface
mp.GridMinCount = 50; // Minimum initial grid quads
mp.RefineGrid = true; // Refine grid
mp.JaggedSeams = false; // jagged seams
mp.SimplePlanes = true; // simple planes
var compMeshes = Mesh.CreateFromBrep(shape, mp);
return Result.Success;
}
By the way separate issue is that when I use go.GetMultiple(1, 0); Rhino will hang when only one object is selected.