From: mpv Date: Wed, 8 Jul 2015 14:27:33 +0000 (+0300) Subject: Remove of composite boolean feature implementation: with sub-sketch X-Git-Tag: V_1.3.0~70 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9ddf765aa139febfce68653fb50282c68759591b;p=modules%2Fshaper.git Remove of composite boolean feature implementation: with sub-sketch --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp index f8fff4cdd..c11ed54d5 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp @@ -79,6 +79,18 @@ void FeaturesPlugin_CompositeBoolean::removeFeature(std::shared_ptr(data()->reference(SKETCH_OBJECT_ID())->value()); + if (aSketch.get() && aSketch->data()->isValid()) { + document()->removeFeature(aSketch); + } + ModelAPI_CompositeFeature::erase(); +} + + //================================================================================================= void FeaturesPlugin_CompositeBoolean::execute() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h index c5ef7f3e6..6838e931b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h +++ b/src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h @@ -58,6 +58,9 @@ class FeaturesPlugin_CompositeBoolean : public ModelAPI_CompositeFeature /// structures of the owner (the remove from the document will be done outside just after) FEATURESPLUGIN_EXPORT virtual void removeFeature(std::shared_ptr theFeature); + /// removes also all sub-sketch + FEATURESPLUGIN_EXPORT virtual void erase(); + protected: FeaturesPlugin_CompositeBoolean(){}; diff --git a/src/Model/Model_ResultPart.cpp b/src/Model/Model_ResultPart.cpp index 5023340b1..5523e7fbd 100644 --- a/src/Model/Model_ResultPart.cpp +++ b/src/Model/Model_ResultPart.cpp @@ -112,7 +112,7 @@ std::shared_ptr Model_ResultPart::shape() { if (myShape.IsNull()) { DocumentPtr aDoc = Model_ResultPart::partDoc(); - if (aDoc.get()) { + if (aDoc.get() && aDoc->isOpened()) { const std::string& aBodyGroup = ModelAPI_ResultBody::group(); TopoDS_Compound aResultComp; BRep_Builder aBuilder; diff --git a/src/ModelAPI/ModelAPI_Tools.cpp b/src/ModelAPI/ModelAPI_Tools.cpp index 2390d72d5..3ffd15ec4 100644 --- a/src/ModelAPI/ModelAPI_Tools.cpp +++ b/src/ModelAPI/ModelAPI_Tools.cpp @@ -174,7 +174,7 @@ CompositeFeaturePtr compositeOwner(const FeaturePtr& theFeature) for(; aRefIter != aRefs.end(); aRefIter++) { CompositeFeaturePtr aComp = std::dynamic_pointer_cast ((*aRefIter)->owner()); - if (aComp.get() && aComp->isSub(theFeature)) + if (aComp.get() && aComp->data()->isValid() && aComp->isSub(theFeature)) return aComp; } }