#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <sstream>
+
//=================================================================================================
FeaturesPlugin_Partition::FeaturesPlugin_Partition()
{
}
GeomAlgoAPI_MakeShapeList aMakeShapeList;
+ std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints = GeomAlgoAPI_ShapeTools::getBoundingBox(anObjects, 1.0);
// Getting tools.
AttributeSelectionListPtr aToolsSelList = selectionList(FeaturesPlugin_Partition::TOOL_LIST_ID());
// it could be a construction plane
ResultPtr aContext = aToolAttr->context();
if(aContext.get()) {
- aTool = GeomAlgoAPI_ShapeTools::faceToInfinitePlane(aContext->shape());
+ aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aContext->shape(), aBoundingPoints);
std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(new GeomAlgoAPI_MakeShapeCustom);
aMkShCustom->addModified(aContext->shape(), aTool);
aMakeShapeList.append(aMkShCustom);
if(theBaseShape->isEqual(theResultShape)) {
theResultBody->store(theResultShape);
} else {
- const int aModifyTag = 1;
- const int aDeletedTag = 2;
- const int aSubsolidsTag = 3; /// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
+ const int aDeletedTag = 1;
+ const int aSubsolidsTag = 2; /// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
+ const int aModifyTag = 100000;
+ int aModifyToolsTag = 200000;
+ std::ostringstream aStream;
theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
std::string aModName = "Modified";
theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- aModifyTag, aModName, theMapOfShapes);
+ aModifyTag, aModName, theMapOfShapes, true);
theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE, aDeletedTag);
+ int anIndex = 1;
for(ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++) {
+ aStream.str(std::string());
+ aStream.clear();
+ aStream << aModName << "_" << anIndex++;
theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
- aModifyTag, aModName, theMapOfShapes);
+ aModifyToolsTag, aStream.str(), theMapOfShapes, true);
theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
+ aModifyToolsTag += 10000;
}
}
}