Hy there,
I am having issues with boolean difference sometimes. I could not fiigure out any regularity behind it. Sometimes it works perfect, sometimes not.
Here you see a profile (grey) and the red solid that needs as boolean solid. On the right are already some holes that have been created with the exact same solid. But this one did not work in my plugin. But when I boolean it within Rhino it works without any problems… Any suggestions for this?
here is part of the code doing the boolean:
booleanDiffResult = Rhino.Geometry.Brep.CreateBooleanDifference(MyBrep, _thisDrillCutter, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);
if (booleanDiffResult != null)
{
if (booleanDiffResult.Count() > 0)
{
maxBrep = booleanDiffResult[0];
foreach(Brep thisBrep in booleanDiffResult )
{
vol = thisBrep.GetVolume();
if(vol>maxVol)
{
maxVol = vol;
maxBrep = thisBrep;
}
}
MyBrep = maxBrep;
}
else
{
if(Rhino.Geometry.Intersect.Intersection.BrepBrep(MyBrep, _thisDrillCutter,RhinoDoc.ActiveDoc.ModelAbsoluteTolerance, out inseCrvs, out insePts ))
{
if(inseCrvs.Count()>0)
{
gr = RhinoDoc.ActiveDoc.Groups.Add();
tmpBrep.Attributes.ObjectColor = System.Drawing.Color.Red;
tmpBrep.Attributes.AddToGroup(gr);
tmpBrep.addRhinoObject(RhinoDoc.ActiveDoc);
pt = tmpBrep.MyBrep.ClosestPoint(Plane.WorldXY.Origin);
warningDot = new roc_dot("drill could not be performed!", pt);
warningDot.Attributes.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject;
warningDot.Attributes.ObjectColor = System.Drawing.Color.Red;
warningDot.Attributes.AddToGroup(gr);
warningDot.addRhinoObject(RhinoDoc.ActiveDoc);
}
}
}
}
}
}