#include <algorithm>
#include <map>
+static const int THE_SPLIT_VERSION_1 = 20190506;
+
//=================================================================================================
FeaturesPlugin_BooleanFill::FeaturesPlugin_BooleanFill()
: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_FILL)
{
}
+//=================================================================================================
+void FeaturesPlugin_BooleanFill::initAttributes()
+{
+ FeaturesPlugin_Boolean::initAttributes();
+ initVersion(THE_SPLIT_VERSION_1, selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID()));
+}
+
//=================================================================================================
void FeaturesPlugin_BooleanFill::execute()
{
std::string anError;
ObjectHierarchy anObjects, aTools;
- ListOfShape aPlanes, anEdgesAndFaces;
+ ListOfShape aPlanes;
// Getting objects.
- if (!processAttribute(OBJECT_LIST_ID(), anObjects, aPlanes, anEdgesAndFaces))
+ if (!processAttribute(OBJECT_LIST_ID(), anObjects, aPlanes))
return;
// Planes are not supported as objects of FILL operation
aPlanes.clear();
// Getting tools.
- if (!processAttribute(TOOL_LIST_ID(), aTools, aPlanes, anEdgesAndFaces))
+ if (!processAttribute(TOOL_LIST_ID(), aTools, aPlanes))
return;
int aResultIndex = 0;
return;
}
+ // version of Split feature
+ int aSplitVersion = version();
+
std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape aResultShapesList;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+
+ GeomShapePtr aResultCompound;
+ if (aSplitVersion == THE_SPLIT_VERSION_1) {
+ // merge hierarchies of compounds containing objects and tools
+ aResultCompound =
+ keepUnusedSubsOfCompound(GeomShapePtr(), anObjects, aTools, aMakeShapeList);
+ }
+
// For solids cut each object with all tools.
bool isOk = true;
for (ObjectHierarchy::Iterator anObjectsIt = anObjects.Begin();
// compsolid handling
isOk = processCompsolid(GeomAlgoAPI_Tools::BOOL_PARTITION,
anObjects, aParent, aTools.Objects(), aPlanes,
- aResultIndex, aResultBaseAlgoList, aResultShapesList);
+ aResultIndex, aResultBaseAlgoList, aResultShapesList,
+ aResultCompound);
} else {
// process object as is
isOk = processObject(GeomAlgoAPI_Tools::BOOL_PARTITION,
anObject, aTools.Objects(), aPlanes,
- aResultIndex, aResultBaseAlgoList, aResultShapesList);
+ aResultIndex, aResultBaseAlgoList, aResultShapesList,
+ aResultCompound);
}
}
+ storeResult(anObjects.Objects(), aTools.Objects(), aResultCompound, aResultIndex,
+ aMakeShapeList, aResultBaseAlgoList);
+
// Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
// result shape has been deleted, but in another it was modified or stayed.
- GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
+ if (!aResultCompound)
+ aResultCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList,
aTools.Objects(),
- aResultShapesCompound);
+ aResultCompound);
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);