From 4f3ea1843a6075ad925d50527c2242b7783753ef Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 20 May 2015 15:30:23 +0300 Subject: [PATCH] A fix for the bug: it is possible to apply extrusion even if the algorithm is failed to build the result. Scenario: create a sketch, create a part, visualize all default planes, create extrusion, select a sketch, in "to" control select a perpendicular plane. An error message appears but "Apply" is enabled. This fix disables the "Apply" button. --- src/ModuleBase/ModuleBase_Operation.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index ba66473b5..17c2e936a 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -71,7 +71,13 @@ bool ModuleBase_Operation::isValid() const //Get validators for the Id SessionPtr aMgr = ModelAPI_Session::get(); ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); - return aFactory->validate(myFeature); + bool aValid = aFactory->validate(myFeature); + + // the feature exec state should be checked in order to do not apply features, which result can not + // be built. E.g. extrusion on sketch, where the "to" is a perpendicular plane to the sketch + bool isDone = myFeature->data()->execState() == ModelAPI_StateDone; + + return aValid && isDone; } -- 2.39.2