Salome HOME
Merge branch 'python_parametric_api' of https://git.salome-platform.org/git/modules...
[modules/shaper.git] / src / PythonAPI / extension / box.py
1 """Box macro-feature Interface
2 Author: Daniel Brunier-Coulin
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 """
5
6 import model
7 from macros.box.feature import BoxFeature as MY
8
9
10 def addBox(self, container, *args):
11     feature = container.addFeature(MY.ID())
12     return Box(feature, *args)
13
14
15 class Box(model.Interface):
16     """Executes the macro-feature Box."""
17
18     def __init__(self, feature, dx, dy, dz):
19         model.Interface.__init__(self, feature)
20
21         self.setRealInput(MY.WIDTH_ID(), dx)
22         self.setRealInput(MY.LENGTH_ID(), dy)
23         self.setRealInput(MY.HEIGHT_ID(), dz)
24
25         if self.areInputValid():
26             self.execute()
27         else:
28             raise Exception("cannot make the Box")