From fbc0af3b9562b40617de7da451a5a292a9ab1690 Mon Sep 17 00:00:00 2001 From: spo Date: Fri, 30 Oct 2015 15:04:04 +0300 Subject: [PATCH] Add _execute() to feature __init__() method. --- src/PythonAPI/model/features/extrusion.py | 2 ++ src/PythonAPI/model/roots.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) 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()) + ) -- 2.39.2