]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Make addBox as a function.
authorspo <sergey.pokhodenko@opencascade.com>
Thu, 22 Oct 2015 06:57:24 +0000 (09:57 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Thu, 22 Oct 2015 06:57:24 +0000 (09:57 +0300)
src/PythonAPI/extension/__init__.py
src/PythonAPI/extension/box.py

index 275cb5503abd07913295db07906df76748d0cc5b..b57f516a153db5d92ce347bbc0406bdcadf51905 100644 (file)
@@ -1,4 +1,4 @@
 """User-defined features.
 """
 
-from box import Box as addBox
\ No newline at end of file
+from box import addBox
\ No newline at end of file
index e0e866c20b7cb5f632c1086bc72a36351b21e4e1..9377fe345310b0b219bc0a51db86670c5048d0dc 100644 (file)
@@ -7,17 +7,22 @@ import model
 from macros.box.feature import BoxFeature as MY
 
 
+def addBox(self, container, *args):
+    feature = container.addFeature(MY.ID())
+    return Box(feature, *args)
+
+
 class Box(model.Interface):
-  """Executes the macro-feature Box.
-  """
-  def __init__(self, part, dx, dy, dz):
-    model.Interface.__init__(self, part, MY.ID())
-
-    self.setRealInput( MY.WIDTH_ID(), dx )
-    self.setRealInput( MY.LENGTH_ID(), dy )
-    self.setRealInput( MY.HEIGHT_ID(), dz )
-
-    if self.areInputValid():
-      self.execute()
-    else:
-      raise Exception("cannot make the Box")
\ No newline at end of file
+    """Executes the macro-feature Box."""
+
+    def __init__(self, feature, dx, dy, dz):
+        model.Interface.__init__(self, feature)
+
+        self.setRealInput(MY.WIDTH_ID(), dx)
+        self.setRealInput(MY.LENGTH_ID(), dy)
+        self.setRealInput(MY.HEIGHT_ID(), dz)
+
+        if self.areInputValid():
+            self.execute()
+        else:
+            raise Exception("cannot make the Box")