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):
20 """Interface class for Placement feature.
22 Placement(feature) -> feature interface without initialization
23 Placement(feature, objects_list, start_shape, end_shape,
24 reverse_direction, centering) ->
25 feature interface initialized from arguments:
33 def __init__(self, feature, *args):
34 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
35 Interface.__init__(self, feature)
36 assert(self._feature.getKind() == "Placement")
38 self._objects_list = self._feature.data().selectionList("placement_objects_list")
39 self._start_shape = self._feature.data().selection("placement_start_shape")
40 self._end_shape = self._feature.data().selection("placement_end_shape")
41 self._reverse_direction = self._feature.data().boolean("placement_reverse_direction")
42 self._centering = self._feature.data().boolean("placement_centering")
44 assert(self._objects_list)
45 assert(self._start_shape)
46 assert(self._end_shape)
47 assert(self._reverse_direction)
48 assert(self._centering)
53 assert(len(args) == 5)
54 self.setObjectList(args[0])
55 self.setStartShape(args[1])
56 self.setEndShape(args[2])
57 self.setReverseDirection(args[3])
58 self.setCentering(args[4])
63 def setObjectList(self, objects_list):
64 """Modify placement_objects_list attribute of the feature.
68 self._fillAttribute(self._objects_list, objects_list)
71 def setStartShape(self, start_shape):
72 """Modify start_shape attribute of the feature.
76 self._fillAttribute(self._start_shape, start_shape)
79 def setEndShape(self, end_shape):
80 """Modify end_shape attribute of the feature.
84 self._fillAttribute(self._end_shape, end_shape)
87 def setReverseDirection(self, reverse_direction):
88 """Modify reverse_direction attribute of the feature.
92 self._fillAttribute(self._reverse_direction, reverse_direction)
95 def setCentering(self, centering):
96 """Modify centering attribute of the feature.
100 self._fillAttribute(self._centering, centering)