Salome HOME
Fix of crash of execution of some python scripts in GUI. This allows to update OB...
authormpv <mpv@opencascade.com>
Wed, 31 Aug 2016 08:00:05 +0000 (11:00 +0300)
committermpv <mpv@opencascade.com>
Wed, 31 Aug 2016 08:00:20 +0000 (11:00 +0300)
src/FeaturesAPI/FeaturesAPI_Extrusion.cpp
src/FeaturesAPI/FeaturesAPI_ExtrusionBoolean.cpp
src/FeaturesAPI/FeaturesAPI_Revolution.cpp
src/FeaturesAPI/FeaturesAPI_RevolutionBoolean.cpp
src/ModelAPI/ModelAPI_Document.h

index e2f3171822432b2969be7e1eceba098ad0876877..4692cc103806a99ae5ec38533c1996af2a3aa7ed 100644 (file)
@@ -113,6 +113,9 @@ FeaturesAPI_Extrusion::~FeaturesAPI_Extrusion()
 void FeaturesAPI_Extrusion::setNestedSketch(const ModelHighAPI_Reference& theSketch)
 {
   mysketch->setValue(theSketch.feature());
+  // to inform that the history is updated due to the sketch moved under the composite feature
+  if (theSketch.feature().get())
+    theSketch.feature()->document()->updateHistory(ModelAPI_Feature::group());
   mybaseObjects->clear();
   mybaseObjects->append(theSketch.feature()->firstResult(), GeomShapePtr());
 
index d384af987bf6d0650a671eb191f7155a4515f10d..386afe55423f87ba697a6e44da4d303a24dd9bd9 100644 (file)
@@ -26,6 +26,9 @@ FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean()
 void FeaturesAPI_ExtrusionBoolean::setNestedSketch(const ModelHighAPI_Reference& theSketch)
 {
   mysketch->setValue(theSketch.feature());
+  // to inform that the history is updated due to the sketch moved under the composite feature
+  if (theSketch.feature().get())
+    theSketch.feature()->document()->updateHistory(ModelAPI_Feature::group());
   mybaseObjects->clear();
   mybaseObjects->append(theSketch.feature()->firstResult(), GeomShapePtr());
 
index 6c09db9f22251506fb1162c51f481479d92639f1..e073541390548852a3dfa017b25b74fdbc8e2f47 100644 (file)
@@ -74,6 +74,9 @@ FeaturesAPI_Revolution::~FeaturesAPI_Revolution()
 void FeaturesAPI_Revolution::setNestedSketch(const ModelHighAPI_Reference& theSketch)
 {
   mysketch->setValue(theSketch.feature());
+  // to inform that the history is updated due to the sketch moved under the composite feature
+  if (theSketch.feature().get())
+    theSketch.feature()->document()->updateHistory(ModelAPI_Feature::group());
   mybaseObjects->clear();
   mybaseObjects->append(theSketch.feature()->firstResult(), GeomShapePtr());
 
index 097fbfbdb5accf241bebb7141061c74fe77c42dd..b463b9a113e9abaf9aae496b9f4d91f826afd52b 100644 (file)
@@ -26,6 +26,9 @@ FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean()
 void FeaturesAPI_RevolutionBoolean::setNestedSketch(const ModelHighAPI_Reference& theSketch)
 {
   mysketch->setValue(theSketch.feature());
+  // to inform that the history is updated due to the sketch moved under the composite feature
+  if (theSketch.feature().get())
+    theSketch.feature()->document()->updateHistory(ModelAPI_Feature::group());
   mybaseObjects->clear();
   mybaseObjects->append(theSketch.feature()->firstResult(), GeomShapePtr());
 
index f8e53575d4263acdacbf052c009c5886d4490fec..17bf943568baa159008658cfa2043cd869c1e67e 100644 (file)
@@ -168,14 +168,15 @@ public:
   virtual bool isLater(std::shared_ptr<ModelAPI_Feature> theLater, 
                        std::shared_ptr<ModelAPI_Feature> theCurrent) const = 0;
 
+  //! Internally makes document know that feature was removed or added in history after creation
+  MODELAPI_EXPORT virtual void updateHistory(const std::string theGroup) = 0;
+
 protected:
   //! Only for SWIG wrapping it is here
   MODELAPI_EXPORT ModelAPI_Document();
 
   //! Internally makes document know that feature was removed or added in history after creation
   MODELAPI_EXPORT virtual void updateHistory(const std::shared_ptr<ModelAPI_Object> theObject) = 0;
-  //! Internally makes document know that feature was removed or added in history after creation
-  MODELAPI_EXPORT virtual void updateHistory(const std::string theGroup) = 0;
 
   friend class ModelAPI_Object; // to add or remove from the history
   friend class ModelAPI_Result; // to add or remove from the history