From: sbh Date: Thu, 27 Nov 2014 06:34:46 +0000 (+0300) Subject: Register one reference feature as concealment to hide it's object in browser X-Git-Tag: V_0.7.0_rc1~57^2~3^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b29344e5fac848b6c64699cd1428f1f7273030e1;p=modules%2Fshaper.git Register one reference feature as concealment to hide it's object in browser --- diff --git a/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py b/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py index 4dbf89abc..d08cf3d95 100644 --- a/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py +++ b/src/PythonFeaturesPlugin/PythonFeaturesPlugin_Box.py @@ -1,7 +1,8 @@ import ModelAPI -import sketch -import extrusion + from SketchResult import SketchResult +import extrusion +import sketch class PythonFeaturesPlugin_Box(ModelAPI.ModelAPI_Feature): @@ -52,17 +53,21 @@ class PythonFeaturesPlugin_Box(ModelAPI.ModelAPI_Feature): self.data().addAttribute(self.LENGTH_REF_ID(), ModelAPI.ModelAPI_AttributeReference_type()) self.data().addAttribute(self.HEIGHT_REF_ID(), ModelAPI.ModelAPI_AttributeReference_type()) aSession = ModelAPI.ModelAPI_Session.get() - aSession.validators().registerNotObligatory(self.getKind(), self.WIDTH_REF_ID()); - aSession.validators().registerNotObligatory(self.getKind(), self.LENGTH_REF_ID()); - aSession.validators().registerNotObligatory(self.getKind(), self.HEIGHT_REF_ID()); + aSession.validators().registerNotObligatory(self.getKind(), self.WIDTH_REF_ID()) + aSession.validators().registerNotObligatory(self.getKind(), self.LENGTH_REF_ID()) + aSession.validators().registerNotObligatory(self.getKind(), self.HEIGHT_REF_ID()) + aSession.validators().registerConcealment(self.getKind(), self.HEIGHT_REF_ID()) def execute(self): aWidth = self.real(self.WIDTH_ID()).value() aLength = self.real(self.LENGTH_ID()).value() aHeight = self.real(self.HEIGHT_ID()).value() + aHeightFeature = None + aHeightFeatureResult = ModelAPI.modelAPI_ResultBody(self.reference(self.HEIGHT_REF_ID()).value()) + if aHeightFeatureResult is not None: + aHeightFeature = aHeightFeatureResult.document().feature(aHeightFeatureResult) aWidthFeature = ModelAPI.modelAPI_Feature(self.reference(self.WIDTH_REF_ID()).value()) aLengthFeature = ModelAPI.modelAPI_Feature(self.reference(self.LENGTH_REF_ID()).value()) - aHeightFeature = ModelAPI.modelAPI_Feature(self.reference(self.HEIGHT_REF_ID()).value()) aResult = None if not all((aWidthFeature, aLengthFeature, aLengthFeature)): aResult = extrusion.getBody(self.makeBox(aLength, aWidth, aHeight)) @@ -103,7 +108,7 @@ class PythonFeaturesPlugin_Box(ModelAPI.ModelAPI_Feature): # Store features... self.reference(self.WIDTH_REF_ID()).setValue(aWidthFeature) self.reference(self.LENGTH_REF_ID()).setValue(aLengthFeature) - self.reference(self.HEIGHT_REF_ID()).setValue(aHeightFeature) + self.reference(self.HEIGHT_REF_ID()).setValue(aHeightFeature.firstResult()) return aHeightFeature