]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Call execute from High API only if feature valid.
authordbv <dbv@opencascade.com>
Thu, 18 Aug 2016 14:58:35 +0000 (17:58 +0300)
committerdbv <dbv@opencascade.com>
Thu, 18 Aug 2016 14:58:35 +0000 (17:58 +0300)
src/Model/Model_Document.cpp
src/ModelHighAPI/ModelHighAPI_Interface.cpp

index 61ba6e53feb7c741b0336e98001de39200cdb50c..0d5767605342df462b4621bde193eeecf9964495 100755 (executable)
@@ -1060,7 +1060,8 @@ void Model_Document::setCurrentFeature(
     if (anIter->setDisabled(aDisabledFlag)) {
       static Events_ID anUpdateEvent = aLoop->eventByName(EVENT_OBJECT_UPDATED);
       // state of feature is changed => so inform that it must be updated if it has such state
-      if (!aDisabledFlag && anIter->data()->execState() == ModelAPI_StateMustBeUpdated)
+      if (!aDisabledFlag && 
+          (anIter->data()->execState() == ModelAPI_StateMustBeUpdated || anIter->data()->execState() == ModelAPI_StateInvalidArgument))
         ModelAPI_EventCreator::get()->sendUpdated(anIter, anUpdateEvent);
       // flush is in the end of this method
       ModelAPI_EventCreator::get()->sendUpdated(anIter, aRedispEvent /*, false*/);
index 3d351650bb60e978d73b914c4f5ac5de593304b8..39b076ffbe7df707a4a35f24cf15cb3aeadfce9c 100644 (file)
@@ -10,6 +10,8 @@
 #include <Events_InfoMessage.h>
 
 #include <ModelAPI_Feature.h>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
 
 #include "ModelHighAPI_Selection.h"
 //--------------------------------------------------------------------------------------
@@ -37,7 +39,12 @@ const std::string& ModelHighAPI_Interface::getKind() const
 
 void ModelHighAPI_Interface::execute()
 {
-  feature()->execute();
+  SessionPtr aMgr = ModelAPI_Session::get();
+  ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
+  FeaturePtr aFeature = feature();
+  if(aFactory->validate(aFeature)) {
+    aFeature->execute();
+  }
 }
 
 std::list<ModelHighAPI_Selection> ModelHighAPI_Interface::result() const