From: spo Date: Fri, 30 Oct 2015 12:04:04 +0000 (+0300) Subject: Add _execute() to feature __init__() method. X-Git-Tag: V_2.1.0~206^2~38 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fbc0af3b9562b40617de7da451a5a292a9ab1690;p=modules%2Fshaper.git Add _execute() to feature __init__() method. --- diff --git a/src/PythonAPI/model/features/extrusion.py b/src/PythonAPI/model/features/extrusion.py index d7aea072f..2e0390813 100644 --- a/src/PythonAPI/model/features/extrusion.py +++ b/src/PythonAPI/model/features/extrusion.py @@ -75,6 +75,8 @@ class Extrusion(Interface): self.setSizes(*args) elif len(args) == 1: self.setSize(args[0]) + + self._execute() pass def __clear(self): diff --git a/src/PythonAPI/model/roots.py b/src/PythonAPI/model/roots.py index a5ac3c201..e3d794efa 100644 --- a/src/PythonAPI/model/roots.py +++ b/src/PythonAPI/model/roots.py @@ -34,6 +34,7 @@ class Interface(): def __init__(self, feature): self._feature = feature self._attribute_white_list = [ + "execute", "getKind", "results", "firstResult", "lastResult", ] @@ -74,5 +75,10 @@ class Interface(): validators = ModelAPI.ModelAPI_Session.get().validators() return validators.validate(self._feature) - def execute(self): - self._feature.execute() + def _execute(self): + if self.areInputValid(): + self._feature.execute() + else: + raise RuntimeError("Can not execute %s: %s" % + (self._feature.getKind(), self._feature.error()) + )