After i make a boolean difference with the function RhinoBooleanDifference the boundingbox does not update and returns a wrong size.
i made a small example:
ON_Brep* sphere1 = ON_BrepSphere(ON_Sphere(ON_3dPoint(0, 0, 0), 10)); ON_Brep* sphere2 = ON_BrepSphere(ON_Sphere(ON_3dPoint(0, 0, 5), 10)); ON_SimpleArray<const ON_Brep*> inBreps1, inBreps2; inBreps1.Append(sphere1); inBreps2.Append(sphere2); bool bResult = false; ON_SimpleArray<ON_Brep*> outBreps; ON_SimpleArray<int> inputIndexForOutput; BOOL ret = RhinoBooleanDifference(inBreps1, inBreps2, 0.002, &bResult, outBreps, inputIndexForOutput); ON_BoundingBox bbSphere1, bbSphere2, bbBoolean; sphere1->GetBoundingBox(bbSphere1); sphere2->GetBoundingBox(bbSphere2); outBreps->GetBoundingBox(bbBoolean); ON_wString dump; ON_TextLog textLog(dump); bbSphere1.Dump(textLog); bbSphere2.Dump(textLog); bbBoolean.Dump(textLog); RhinoPrint(CString(dump)); RhinoApp().ActiveDoc()->AddBrepObject(*sphere1); RhinoApp().ActiveDoc()->AddBrepObject(*sphere2); RhinoApp().ActiveDoc()->AddBrepObject(*outBreps);
The output in the command line window is as follow:
Bounding box: -10 to 10, -10 to 10, -10 to 10
Bounding box: -10 to 10, -10 to 10, -5 to 15
Bounding box: -10 to 10, -10 to 10, -10 to 15
As you can see, the bounding box of the resulting brep is in z direction -10 to 15, which is definitely not right! The result in 3D looks as expected. (I moved the 2 spheres afterwards to see the result, which is the red geometry)
Do you have any advise to get the right bounding box after the boolean difference?