2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 from model.roots import Interface
9 def addPlacement(part, *args):
10 """Add an Placement feature to the Part and return Placement.
12 Pass all args to Placement __init__ function.
15 feature = part.addFeature("Placement")
16 return Placement(feature, *args)
19 class Placement(Interface):
21 def __init__(self, feature, *args):
22 Interface.__init__(self, feature)
23 assert(self._feature.getKind() == "Placement")
25 self._objects_list = self._feature.data().selectionList("placement_objects_list")
26 self._start_shape = self._feature.data().selection("placement_start_shape")
27 self._end_shape = self._feature.data().selection("placement_end_shape")
28 self._reverse_direction = self._feature.data().boolean("placement_reverse_direction")
29 self._centering = self._feature.data().boolean("placement_centering")
31 assert(len(args) == 5)
32 self.setObjectList(args[0])
33 self.setStartShape(args[1])
34 self.setEndShape(args[2])
35 self.setReverseDirection(args[3])
36 self.setCentering(args[4])
39 def setObjectList(self, objects_list):
40 """Modify placement_objects_list attribute of the feature.
44 self._fill_attribute(self._objects_list, objects_list)
47 def setStartShape(self, start_shape):
48 """Modify start_shape attribute of the feature.
52 self._fill_attribute(self._start_shape, start_shape)
55 def setEndShape(self, end_shape):
56 """Modify end_shape attribute of the feature.
60 self._fill_attribute(self._end_shape, end_shape)
63 def setReverseDirection(self, reverse_direction):
64 """Modify reverse_direction attribute of the feature.
68 self._fill_attribute(self._reverse_direction, reverse_direction)
71 def setCentering(self, centering):
72 """Modify centering attribute of the feature.
76 self._fill_attribute(self._centering, centering)