From 935db942b8a84d02d2e6c2d0d779197c57d3dc1a Mon Sep 17 00:00:00 2001 From: dbv Date: Thu, 18 Aug 2016 17:58:35 +0300 Subject: [PATCH] Call execute from High API only if feature valid. --- src/Model/Model_Document.cpp | 3 ++- src/ModelHighAPI/ModelHighAPI_Interface.cpp | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index 61ba6e53f..0d5767605 100755 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -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*/); diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index 3d351650b..39b076ffb 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -10,6 +10,8 @@ #include #include +#include +#include #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_Interface::result() const -- 2.39.2