]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #1997 : correct update of the point of sketch after update of sketc...
authormpv <mpv@opencascade.com>
Wed, 22 Mar 2017 11:02:32 +0000 (14:02 +0300)
committermpv <mpv@opencascade.com>
Wed, 22 Mar 2017 11:02:32 +0000 (14:02 +0300)
src/Model/Model_Update.cpp

index f95f59d7c0f81a202ca8d4f42d8eba5f1338feb4..5c0965e7d864b3e27ecdef192a49dea90601662b 100755 (executable)
@@ -24,6 +24,7 @@
 #include <ModelAPI_CompositeFeature.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Tools.h>
+#include <GeomAPI_Shape.h>
 #include <GeomDataAPI_Point.h>
 #include <GeomDataAPI_Point2D.h>
 #include <Events_Loop.h>
@@ -484,7 +485,21 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
         }
       }
     }
+    std::shared_ptr<GeomAPI_Shape> aShapeBefore = anExtSel->value();
+    if (!aShapeBefore.get() && anExtSel->context()) aShapeBefore = anExtSel->context()->shape();
     updateArguments(theFeature);
+    std::shared_ptr<GeomAPI_Shape> aShapeAfter = anExtSel->value();
+    if (!aShapeAfter.get() && anExtSel->context()) aShapeAfter = anExtSel->context()->shape();
+    // if selected plane is different, make all subs taouched, reason of this sketch to be recomputed
+    if (aShapeBefore.get() && !aShapeBefore->isEqual(aShapeAfter)) {
+      std::set<FeaturePtr> aWholeR;
+      allReasons(theFeature, aWholeR);
+      std::set<FeaturePtr>::iterator aRIter = aWholeR.begin();
+      for(; aRIter != aWholeR.end(); aRIter++) {
+        if ((*aRIter)->data()->selection("External"))
+          (*aRIter)->attributeChanged("External");
+      }
+    }
     // send event that sketch is prepared to be recomputed
     static Events_ID anID = Events_Loop::eventByName("SketchPrepared");
     std::shared_ptr<Events_Message> aMsg(new Events_Message(anID, this));
@@ -633,7 +648,6 @@ ModelAPI_ExecState stateByReference(ObjectPtr theTarget, const ModelAPI_ExecStat
 void Model_Update::updateArguments(FeaturePtr theFeature) {
   // perform this method also for disabled features: to make "not done" state for
   // features referenced to the active and modified features
-
   static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
 
   ModelAPI_ExecState aState = theFeature->data()->execState();