1 """Box macro-feature Interface
2 Author: Daniel Brunier-Coulin
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from model import Interface
7 from macros.box.feature import BoxFeature as MY
10 def addBox(part, *args):
11 """Add Box feature to the part and return Box.
13 Pass all args to Box __init__ function.
15 feature = part.addFeature(MY.ID())
16 return Box(feature, *args)
20 """Executes the macro-feature Box.
22 Box(feature) -> feature interface without initialization
23 Extrusion(feature, dx, dy, dz) ->
24 feature interface initialized from arguments:
25 - dx, dy, dz -- box dimensions
28 def __init__(self, feature, *args):
29 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
30 Interface.__init__(self, feature)
31 assert(self._feature.getKind() == MY.ID())
33 self._width = self._feature.real(MY.WIDTH_ID())
34 self._length = self._feature.real(MY.LENGTH_ID())
35 self._height = self._feature.real(MY.HEIGHT_ID())
44 assert(len(args) == 3)
53 def setWidth(self, width):
54 """B.setWidth(float) -- modify width attribute"""
55 self._fillAttribute(self._width, width)
58 def setLength(self, length):
59 """B.setLength(float) -- modify length attribute"""
60 self._fillAttribute(self._length, length)
63 def setHeight(self, height):
64 """B.setHeight(float) -- modify height attribute"""
65 self._fillAttribute(self._height, height)