#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeInteger.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
#include <ModelAPI_Session.h>
#include <GeomAlgoAPI_Boolean.h>
#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_PaveFiller.h>
+#include <GeomAlgoAPI_ShapeBuilder.h>
#include <GeomAlgoAPI_ShapeTools.h>
#include <GeomAlgoAPI_Tools.h>
#include <GeomAlgoAPI_UnifySameDomain.h>
+
#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
//==================================================================================================
FeaturesPlugin_BooleanFuse::FeaturesPlugin_BooleanFuse()
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), OBJECT_LIST_ID());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID());
+
+ initVersion(THE_VERSION_1, selectionList(OBJECT_LIST_ID()), selectionList(TOOL_LIST_ID()));
}
//==================================================================================================
return;
}
+ // version of FUSE feature
+ int aFuseVersion = version();
+
// Collecting all solids which will be fused.
ListOfShape aSolidsToFuse;
aSolidsToFuse.insert(aSolidsToFuse.end(), anObjects.begin(), anObjects.end());
// Collecting solids from compsolids which will not be modified
// in boolean operation and will be added to result.
+ bool isProcessCompsolid = !isSimpleCreation || aFuseVersion >= THE_FUSE_VERSION_1;
ListOfShape aShapesToAdd;
for (ObjectHierarchy::Iterator anObjectsIt = anObjectsHierarchy.Begin();
- !isSimpleCreation && anObjectsIt != anObjectsHierarchy.End();
+ isProcessCompsolid && anObjectsIt != anObjectsHierarchy.End();
++anObjectsIt) {
GeomShapePtr anObject = *anObjectsIt;
GeomShapePtr aParent = anObjectsHierarchy.Parent(anObject, false);
aMakeShapeList->appendAlgo(aCutAlgo);
}
}
- anOriginalShapes.insert(anOriginalShapes.end(), anEdgesAndFaces.begin(),
- anEdgesAndFaces.end());
+
+ if (aShapesToAdd.empty() || !aCuttedEdgesAndFaces) {
+ anOriginalShapes.insert(anOriginalShapes.end(), anEdgesAndFaces.begin(),
+ anEdgesAndFaces.end());
+ }
// If we have compsolids then cut with not used solids all others.
if (!aShapesToAdd.empty()) {
aMakeShapeList->appendAlgo(aUnifyAlgo);
}
+ if (aFuseVersion == THE_VERSION_1) {
+ // merge hierarchies of compounds containing objects and tools
+ // and append the result of the FUSE operation
+ aShape = keepUnusedSubsOfCompound(aShape, anObjectsHierarchy, aToolsHierarchy, aMakeShapeList);
+ }
+
int aResultIndex = 0;
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);