By Adam Nagy
I'm using booleanOper() to merge some solids in the drawing. It seems to work fine, however, on some PC's the created solids may crash AutoCAD when the user moves them.
Solution
Looking at your code I can see that you are not deleting the input solid from the database.
You should delete it, because booleanOper() removes the geometry of the input solid and you should not leave degenerate solids in the database:
static void ArxTestMyCommand1(void)
{
AcDbDatabase * pDb =
acdbHostApplicationServices()->workingDatabase();
ads_name name;
ads_point pt;
AcDbObjectId id;
AcDbObjectPointer<AcDb3dSolid> solids[2];
for (int i = 0; i < 2; i++)
{
if (RTNORM != acedEntSel(L"\nSelect a solid", name, pt))
return;
acdbGetObjectId(id, name);
solids[i].open(id, AcDb::kForWrite);
}
// This will merge the geometry of the input solid (solids[1])
// into the geometry of solids[0] and then erase the geometry of
// the input solid (solids[1])
solids[0]->booleanOper(AcDb::kBoolUnite, solids[1]);
// We should delete solids[1] otherwise we leave a solid with
// degenerate geometry (i.e. zero geometry) in the database
// and that could cause issues
solids[1]->erase();
}