From: dbv Date: Wed, 6 Apr 2016 13:56:09 +0000 (+0300) Subject: Composite features fix. X-Git-Tag: V_2.3.0~288 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aee42c3f5830152dc7aba7d92419aaf94d0e16cb;p=modules%2Fshaper.git Composite features fix. --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index 5c86e7eb7..89d4d54a4 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -25,7 +25,7 @@ void FeaturesPlugin_CompositeBoolean::initBooleanAttributes() } //================================================================================================= -void FeaturesPlugin_CompositeBoolean::execute() +void FeaturesPlugin_CompositeBoolean::executeCompositeBoolean() { // Make generation. ListOfShape aGenBaseShapes; @@ -76,7 +76,11 @@ void FeaturesPlugin_CompositeBoolean::execute() int aModTag = aTag; storeModificationHistory(aResultBody, *aBoolObjIt, aTools, *aBoolMSIt, aModTag); + + myFeature->setResult(aResultBody, aResultIndex++); } + + myFeature->removeResults(aResultIndex); } //================================================================================================= @@ -179,8 +183,8 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, return false; } - GeomAlgoAPI_MakeShapeList aMakeShapeList; - aMakeShapeList.appendAlgo(aBoolAlgo); + std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); + aMakeShapeList->appendAlgo(aBoolAlgo); // Add result to not used solids from compsolid. aShapesToAdd.push_back(aBoolAlgo->shape()); @@ -190,11 +194,11 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, return false; } - aMakeShapeList.appendAlgo(aFillerAlgo); + aMakeShapeList->appendAlgo(aFillerAlgo); if(GeomAlgoAPI_ShapeTools::volume(aFillerAlgo->shape()) > 1.e-7) { theObjects.push_back(aCompSolid); - theMakeShapes.push_back(aBoolAlgo); + theMakeShapes.push_back(aMakeShapeList); } } break; @@ -207,7 +211,7 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, // Filter edges and faces in tools. ListOfShape aTools; - for(ListOfShape::const_iterator anIt = aTools.cbegin(); anIt != aTools.cend(); ++anIt) { + for(ListOfShape::const_iterator anIt = theTools.cbegin(); anIt != theTools.cend(); ++anIt) { if((*anIt)->shapeType() == GeomAPI_Shape::EDGE || (*anIt)->shapeType() == GeomAPI_Shape::FACE) { anEdgesAndFaces.push_back(*anIt); @@ -255,7 +259,7 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, aCutTools.insert(aCutTools.end(), aCompSolids.begin(), aCompSolids.end()); aCutTools.insert(aCutTools.end(), aTools.begin(), aTools.end()); - GeomAlgoAPI_MakeShapeList aMakeShapeList; + std::shared_ptr aMakeShapeList(new GeomAlgoAPI_MakeShapeList()); if(!anEdgesAndFaces.empty() && !aCutTools.empty()) { std::shared_ptr aCutAlgo(new GeomAlgoAPI_Boolean(anEdgesAndFaces, aCutTools, @@ -263,7 +267,7 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, if(aCutAlgo->isDone() && !aCutAlgo->shape()->isNull() && aCutAlgo->isValid()) { anEdgesAndFaces.clear(); anEdgesAndFaces.push_back(aCutAlgo->shape()); - aMakeShapeList.appendAlgo(aCutAlgo); + aMakeShapeList->appendAlgo(aCutAlgo); } } @@ -275,7 +279,7 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, if(aCutAlgo->isDone() && GeomAlgoAPI_ShapeTools::volume(aCutAlgo->shape()) > 1.e-7) { aSolidsToFuse.clear(); aSolidsToFuse.push_back(aCutAlgo->shape()); - aMakeShapeList.appendAlgo(aCutAlgo); + aMakeShapeList->appendAlgo(aCutAlgo); } } @@ -300,7 +304,7 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, } aFusedShape = aFuseAlgo->shape(); - aMakeShapeList.appendAlgo(aFuseAlgo); + aMakeShapeList->appendAlgo(aFuseAlgo); } // Combine result with not used solids from compsolid and edges and faces (if we have any). @@ -316,8 +320,10 @@ bool FeaturesPlugin_CompositeBoolean::makeBoolean(const ListOfShape& theTools, return false; } - aMakeShapeList.appendAlgo(aFillerAlgo); + aMakeShapeList->appendAlgo(aFillerAlgo); } + + theMakeShapes.push_back(aMakeShapeList); break; } } diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h index daa2e060d..34b88aebc 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h @@ -34,7 +34,7 @@ public: } /// Creates a new part document if needed. - FEATURESPLUGIN_EXPORT virtual void execute(); + FEATURESPLUGIN_EXPORT virtual void executeCompositeBoolean(); protected: FeaturesPlugin_CompositeBoolean(){}; diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp index 7b885df7a..f7344b0a4 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp @@ -12,3 +12,9 @@ FeaturesPlugin_ExtrusionCut::FeaturesPlugin_ExtrusionCut() myFeature = this; myOperationType = BOOL_CUT; } + +//================================================================================================= +void FeaturesPlugin_ExtrusionCut::execute() +{ + executeCompositeBoolean(); +} diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h index acfa643c8..1d3d7c3d4 100755 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h @@ -32,6 +32,9 @@ public: static std::string MY_KIND = FeaturesPlugin_ExtrusionCut::ID(); return MY_KIND; } + + /// Creates a new part document if needed. + FEATURESPLUGIN_EXPORT virtual void execute(); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp index 956a02648..da93295e0 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.cpp @@ -12,3 +12,9 @@ FeaturesPlugin_ExtrusionFuse::FeaturesPlugin_ExtrusionFuse() myFeature = this; myOperationType = BOOL_FUSE; } + +//================================================================================================= +void FeaturesPlugin_ExtrusionFuse::execute() +{ + executeCompositeBoolean(); +} diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h index 5e7a3236f..dfa723632 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionFuse.h @@ -32,6 +32,9 @@ public: static std::string MY_KIND = FeaturesPlugin_ExtrusionFuse::ID(); return MY_KIND; } + + /// Creates a new part document if needed. + FEATURESPLUGIN_EXPORT virtual void execute(); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.cpp index 7685a77cb..881879717 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.cpp @@ -12,3 +12,9 @@ FeaturesPlugin_RevolutionCut::FeaturesPlugin_RevolutionCut() myFeature = this; myOperationType = BOOL_CUT; } + +//================================================================================================= +void FeaturesPlugin_RevolutionCut::execute() +{ + executeCompositeBoolean(); +} diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h index 481cfd995..d63073c9f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionCut.h @@ -32,6 +32,9 @@ public: static std::string MY_KIND = FeaturesPlugin_RevolutionCut::ID(); return MY_KIND; } + + /// Creates a new part document if needed. + FEATURESPLUGIN_EXPORT virtual void execute(); }; #endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.cpp b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.cpp index 8bed6dad7..687a1ffb6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.cpp @@ -12,3 +12,9 @@ FeaturesPlugin_RevolutionFuse::FeaturesPlugin_RevolutionFuse() myFeature = this; myOperationType = BOOL_FUSE; } + +//================================================================================================= +void FeaturesPlugin_RevolutionFuse::execute() +{ + executeCompositeBoolean(); +} diff --git a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h index bdc7f8e57..32fc8a6ec 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h +++ b/src/FeaturesPlugin/FeaturesPlugin_RevolutionFuse.h @@ -32,6 +32,9 @@ class FeaturesPlugin_RevolutionFuse : public FeaturesPlugin_RevolutionBoolean static std::string MY_KIND = FeaturesPlugin_RevolutionFuse::ID(); return MY_KIND; } + + /// Creates a new part document if needed. + FEATURESPLUGIN_EXPORT virtual void execute(); }; #endif