ADD_SUBDIRECTORY (src/SketchSolver)
ADD_SUBDIRECTORY (src/ModuleBase)
ADD_SUBDIRECTORY (src/PartSet)
+ADD_SUBDIRECTORY (src/DFBrowser)
IF(NOT ${HAVE_SALOME})
ADD_SUBDIRECTORY (src/AppElements)
#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <sstream>
+
//=================================================================================================
FeaturesPlugin_Partition::FeaturesPlugin_Partition()
{
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;
}
}
}
(theSubShape == anOldShape || (theSubShape && anOldShape && theSubShape->isEqual(anOldShape)));
if (isOldShape) return; // shape is the same, so context is also unchanged
// update the referenced object if needed
- if (!isOldContext)
- myRef.setValue(theContext);
+ if (!isOldContext) {
+ ResultCompSolidPtr anOwner = ModelAPI_Tools::compSolidOwner(theContext);
+ if (anOwner.get())
+ myRef.setValue(anOwner);
+ else
+ myRef.setValue(theContext);
+ }
// do noth use naming if selected shape is result shape itself, but not sub-shape
TDF_Label aSelLab = selectionLabel();
const int theKindOfShape,
const int theTag,
const std::string& theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes)
+ GeomAPI_DataMapOfShapeShape& theSubShapes,
+ const bool theIsStoreSeparate)
{
+ int aTag = theTag;
+ std::string aName = theName;
+ std::ostringstream aStream;
+ int anIndex = 1;
TopoDS_Shape aShapeIn = theShapeIn->impl<TopoDS_Shape>();
TopTools_MapOfShape aView;
bool isBuilt = theName.empty();
aNewShape.Orientation(aMapShape->impl<TopoDS_Shape>().Orientation());
}
if (!aRoot.IsSame (aNewShape)) {
- builder(theTag)->Modify(aRoot,aNewShape);
- if(!isBuilt)
- buildName(theTag, theName);
+ builder(aTag)->Modify(aRoot,aNewShape);
+ if(!isBuilt) {
+ if(theIsStoreSeparate) {
+ aStream.str(std::string());
+ aStream.clear();
+ aStream << theName << "_" << anIndex++;
+ aName = aStream.str();
+ }
+ buildName(aTag, aName);
+ }
+ if(theIsStoreSeparate) {
+ aTag++;
+ }
}
}
}
const int theKindOfShape,
const int theTag,
const std::string& theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes);
+ GeomAPI_DataMapOfShapeShape& theSubShapes,
+ const bool theIsStoreSeparate = false);
/// load and orient generated shapes
MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
GeomAlgoAPI_MakeShape* theMS,
const int theKindOfShape,
const int theTag,
const std::string& theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
+ GeomAPI_DataMapOfShapeShape& theSubShapes,
+ const bool theIsStoreSeparate = false) = 0;
/// load and orient generated shapes
virtual void loadAndOrientGeneratedShapes (
GeomAlgoAPI_MakeShape* theMS,
void ModelAPI_ResultBody::loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
- const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes)
+ const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, const bool theIsStoreSeparate)
{
myBuilder->loadAndOrientModifiedShapes(
- theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
+ theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate);
}
void ModelAPI_ResultBody::loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
/// load and orient modified shapes
MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
- const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes);
+ const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes, const bool theIsStoreSeparate = false);
/// load and orient generated shapes
MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes (GeomAlgoAPI_MakeShape* theMS,
std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape,