]> SALOME platform Git repositories - modules/shaper.git/blob - src/PythonAPI/model/features/roots.py
Salome HOME
2aeacfe171a5e6037a7e0d11f44ba556cd46ec60
[modules/shaper.git] / src / PythonAPI / model / features / roots.py
1
2 from model.roots import Interface
3
4
5 class CompositeBoolean(Interface):
6     """Interface class for CompositeBoolean features.
7
8     CompositeBoolean(feature) -> feature interface without initialization
9     CompositeBoolean(feature, sketch, sketch_selection, boolean_objects) ->
10         feature interface initialized from arguments:
11         - sketch
12         - sketch_selection
13         - boolean_objects
14     """
15
16     def __init__(self, feature, *args):
17         """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
18         Interface.__init__(self, feature)
19
20         self._sketch = self._feature.reference("sketch")
21         self._sketch_selection = self._feature.selection("sketch_selection")
22         self._boolean_objects = self._feature.selectionList("boolean_objects")
23
24         assert(self._sketch)
25         assert(self._sketch_selection)
26         assert(self._boolean_objects)
27
28         if not args:
29             return
30
31         assert(len(args) == 3)
32         sketch, sketch_selection, boolean_objects = args
33
34         self.setSketch(sketch)
35         self.setSketchSelection(sketch_selection)
36         self.setBooleanObjects(boolean_objects)
37         pass
38
39     def setSketch(self, sketch):
40         """Modify sketch attribute"""
41         self._fillAttribute(self._sketch, sketch)
42         pass
43
44     def setSketchSelection(self, sketch_selection):
45         """Modify sketch_selection attribute"""
46         self._fillAttribute(self._sketch_selection, sketch_selection)
47         pass
48
49     def setBooleanObjects(self, boolean_objects):
50         """Modify boolean_objects attribute"""
51         self._fillAttribute(self._boolean_objects, boolean_objects)
52         pass
53
54
55 class CompositeSketch(Interface):
56     """Interface class for CompositeSketch features.
57
58     CompositeSketch(feature) -> feature interface without initialization
59     CompositeSketch(feature, sketch, sketch_selection) ->
60         feature interface initialized from arguments:
61         - sketch
62         - sketch_selection
63     """
64
65
66     def __init__(self, feature, *args):
67         """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
68         Interface.__init__(self, feature)
69
70         self._sketch = self._feature.reference("sketch")
71         self._sketch_selection = self._feature.selection("sketch_selection")
72
73         assert(self._sketch)
74         assert(self._sketch_selection)
75
76         if not args:
77             return
78
79         assert(len(args) == 2)
80         sketch, sketch_selection = args
81
82         self.setSketch(sketch)
83         self.setSketchSelection(sketch_selection)
84         pass
85
86     def setSketch(self, sketch):
87         """Modify sketch attribute"""
88         self._fillAttribute(self._sketch, sketch)
89         pass
90
91     def setSketchSelection(self, sketch_selection):
92         """Modify sketch_selection attribute"""
93         self._fillAttribute(self._sketch_selection, sketch_selection)
94         pass