]> SALOME platform Git repositories - modules/shaper.git/blob - src/PythonAPI/model/features/placement.py
Salome HOME
Add feature Placement without tests.
[modules/shaper.git] / src / PythonAPI / model / features / placement.py
1 """Placement Interface
2 Author: Sergey Pokhodenko
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 """
5
6 from model.roots import Interface
7
8
9 def addPlacement(part, *args):
10     """Add an Placement feature to the Part and return Placement.
11
12     Pass all args to Placement __init__ function.
13     """
14     assert(args)
15     feature = part.addFeature("Placement")
16     return Placement(feature, *args)
17
18
19 class Placement(Interface):
20
21     def __init__(self, feature, *args):
22         Interface.__init__(self, feature)
23         assert(self._feature.getKind() == "Placement")
24
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")
30
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])
37         pass
38
39     def setObjectList(self, objects_list):
40         """Modify placement_objects_list attribute of the feature.
41
42         See __init__.
43         """
44         self._fill_attribute(self._objects_list, objects_list)
45         pass
46
47     def setStartShape(self, start_shape):
48         """Modify start_shape attribute of the feature.
49
50         See __init__.
51         """
52         self._fill_attribute(self._start_shape, start_shape)
53         pass
54
55     def setEndShape(self, end_shape):
56         """Modify end_shape attribute of the feature.
57
58         See __init__.
59         """
60         self._fill_attribute(self._end_shape, end_shape)
61         pass
62
63     def setReverseDirection(self, reverse_direction):
64         """Modify reverse_direction attribute of the feature.
65
66         See __init__.
67         """
68         self._fill_attribute(self._reverse_direction, reverse_direction)
69         pass
70
71     def setCentering(self, centering):
72         """Modify centering attribute of the feature.
73
74         See __init__.
75         """
76         self._fill_attribute(self._centering, centering)
77         pass