]> SALOME platform Git repositories - modules/shaper.git/blob - src/PythonAPI/model/partset/part.py
Salome HOME
Improve PythonAPI documentstion.
[modules/shaper.git] / src / PythonAPI / model / partset / part.py
1 """Part Feature Interface
2 Author: Daniel Brunier-Coulin
3 Copyright (C) 2014-20xx CEA/DEN, EDF R&D
4 """
5
6 import ModelAPI
7
8 from model.roots import Interface
9
10
11 def addPart(partset):
12     """Add a Part feature to the Part and return Part.
13
14     Pass all args to Part __init__ function.
15     """
16     feature = partset.addFeature("Part")
17     return Part(feature)
18
19 def duplicatePart(part):
20     """Create a copy of the Part."""
21     feature = part.addFeature("Duplicate")
22     feature.execute()
23     return Part(feature)
24
25 def removePart(part):
26     """Remove the Part."""
27     feature = part.addFeature("Remove")
28     feature.execute()
29
30
31 class Part(Interface):
32     """Interface class for Part feature.
33
34     Part(feature) -> feature interface without initialization
35     """
36
37     def __init__(self, feature):
38         """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
39         Interface.__init__(self, feature)
40         assert(self._feature.getKind() == "Part")
41
42         self._execute()
43         pass
44
45     def document(self):
46         """Returns the Part document created by this feature."""
47         result_part = ModelAPI.modelAPI_ResultPart(self._feature.firstResult())
48         return result_part.partDoc()