From 5090ea57c88f874ec211b5addb28e413db5eb68e Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 19 Mar 2015 12:46:34 +0300 Subject: [PATCH] Make preview of python Box feature working correctly --- src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py b/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py index 2487a6ee8..fd5686355 100644 --- a/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py +++ b/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py @@ -136,7 +136,7 @@ class PythonFeaturesPlugin_Box(ModelAPI.ModelAPI_CompositeFeature): return subsCount def subFeature(self, theIndex): - if theIndex == 1: # sketch + if theIndex == 0: # sketch return ModelAPI.compositeFeatureToFeature(self.mySketch) return self.myExtrusion @@ -146,6 +146,15 @@ class PythonFeaturesPlugin_Box(ModelAPI.ModelAPI_CompositeFeature): def isSub(self, theFeature): return theFeature == self.mySketch or theFeature == self.myExtrusion + def attributeChanged(self, theAttrID): + # on update of attributes values, transfer them to sub-features immideately to see good preview + # otherwise these features will be executed before execute of "Box" and with old parameters + aWidthRefValue = self.reference(self.WIDTH_REF_ID()).value() + aLengthRefValue = self.reference(self.LENGTH_REF_ID()).value() + aHeightRefValue = self.reference(self.HEIGHT_REF_ID()).value() + if all((aWidthRefValue, aLengthRefValue, aHeightRefValue)): + self.execute() + # TEST """ if __name__=='__main__': -- 2.39.2