]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Remove of composite boolean feature implementation: with sub-sketch
authormpv <mpv@opencascade.com>
Wed, 8 Jul 2015 14:27:33 +0000 (17:27 +0300)
committermpv <mpv@opencascade.com>
Wed, 8 Jul 2015 14:27:33 +0000 (17:27 +0300)
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeBoolean.h
src/Model/Model_ResultPart.cpp
src/ModelAPI/ModelAPI_Tools.cpp

index f8fff4cdde077df292f856a7cf095e60e2b8813f..c11ed54d5fa7d021c69a1a7b7df77ad93c5bae27 100644 (file)
@@ -79,6 +79,18 @@ void FeaturesPlugin_CompositeBoolean::removeFeature(std::shared_ptr<ModelAPI_Fea
 {
 }
 
+//=================================================================================================
+void FeaturesPlugin_CompositeBoolean::erase()
+{
+  FeaturePtr aSketch =
+    std::dynamic_pointer_cast<ModelAPI_Feature>(data()->reference(SKETCH_OBJECT_ID())->value());
+  if (aSketch.get() && aSketch->data()->isValid()) {
+    document()->removeFeature(aSketch);
+  }
+  ModelAPI_CompositeFeature::erase();
+}
+
+
 //=================================================================================================
 void FeaturesPlugin_CompositeBoolean::execute()
 {
index c5ef7f3e6e656c640e4ad3879dcb73db8cf630d0..6838e931bb972ef32f3995eeb0feaeaa67d5f175 100644 (file)
@@ -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<ModelAPI_Feature> theFeature);
 
+  /// removes also all sub-sketch
+  FEATURESPLUGIN_EXPORT virtual void erase();
+
 protected:
   FeaturesPlugin_CompositeBoolean(){};
 
index 5023340b1b5f8f6a08a712b665966a4e20921e9d..5523e7fbd5b21d14552a973f925ebba12ed33335 100644 (file)
@@ -112,7 +112,7 @@ std::shared_ptr<GeomAPI_Shape> 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;
index 2390d72d5d57255bfffe031298f319ba3aa0eae3..3ffd15ec47decc84cf994de4df460a061a60915c 100644 (file)
@@ -174,7 +174,7 @@ CompositeFeaturePtr compositeOwner(const FeaturePtr& theFeature)
     for(; aRefIter != aRefs.end(); aRefIter++) {
       CompositeFeaturePtr aComp = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>
         ((*aRefIter)->owner());
-      if (aComp.get() && aComp->isSub(theFeature))
+      if (aComp.get() && aComp->data()->isValid() && aComp->isSub(theFeature))
         return aComp;
     }
   }