]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1440 Crash when edit box with parameter: height of the box using parameter...
authornds <nds@opencascade.com>
Tue, 26 Apr 2016 07:01:33 +0000 (10:01 +0300)
committernds <nds@opencascade.com>
Tue, 26 Apr 2016 07:01:59 +0000 (10:01 +0300)
src/PythonAPI/model/features/extrusion.py
src/PythonAddons/macros/box/feature.py

index f0cb7c403a37286c6a9e7faae74a24345b5f6b7c..7e87ace83ac5cc411f4e2862e5d371f10ba6489a 100644 (file)
@@ -126,7 +126,7 @@ class Extrusion(Interface):
         self._fillAttribute(self._base, base)
         pass
 
-    def setSizes(self, to_size, from_size):
+    def setSizes(self, to_size, from_size, to_size_text="", from_size_text=""):
         """Modify the to_size, from_size attributes of the feature.
 
         See __init__.
@@ -136,23 +136,34 @@ class Extrusion(Interface):
         # values without changes that causes cyclic dependency
         #self.__clear()
         self._fillAttribute(self._CreationMethod, "BySizes")
-        self._fillAttribute(self._to_size, to_size)
-        self._fillAttribute(self._from_size, from_size)
+        if to_size_text == "":
+            self._fillAttribute(self._to_size, to_size)
+        else:
+            self._fillAttribute(self._to_size, to_size_text)
+
+        if from_size_text == "":
+            self._fillAttribute(self._from_size, from_size)
+        else:
+            self._fillAttribute(self._to_size, from_size_text)
         pass
 
-    def setSize(self, size):
+    def setSize(self, size, text=""):
         """Modify the size of the feature.
 
         If size is positive then initialize to_size with size.
         If size is negative then initialize from_size with -size.
         """
         to_size, from_size = 0, 0
+        to_size_text, from_size_text = "", ""
         if size >= 0:
             to_size = size
+            to_size_text = text
         else:
             from_size = -size
+            from_size_text = text
+
+        self.setSizes(to_size, from_size, to_size_text, from_size_text)
 
-        self.setSizes(to_size, from_size)
         pass
 
     def setPlanesAndOffsets(self, to_object, to_offset,
index 4238622c68aab5ca7858761563eb859e7b87d943..6341e432ac8830fcad815ec562058f0ccc85dd33 100644 (file)
@@ -95,13 +95,17 @@ class BoxFeature(model.Feature):
         height_text = self.getTextInput(self.HEIGHT_ID())
 
         # Editing the box
-        self.base.setValue(self.width, width)
-        self.base.setText(self.width, width_text)
+        if width_text == "":
+            self.base.setValue(self.width, width)
+        else:
+            self.base.setText(self.width, width_text)
 
-        self.base.setValue(self.length, length)
-        self.base.setText(self.length, length_text)
+        if length_text != "":
+            self.base.setValue(self.length, length)
+        else:
+            self.base.setText(self.length, length_text)
 
-        self.box.setSize(height)
+        self.box.setSize(height, height_text)
 
         # Publishing the result: not needed for Macro feature
         # self.addResult( self.box.result() )