]> SALOME platform Git repositories - modules/shaper.git/blob - src/PythonAPI/model/partset/part.py
Salome HOME
Rename addExport() to exportToFile().
[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
33     def __init__(self, feature):
34         """Adds a new Part to the given Partset and activates the Part."""
35         Interface.__init__(self, feature)
36         assert(self._feature.getKind() == "Part")
37         pass
38
39     def document(self):
40         """Returns the Part document created by this feature."""
41         result_part = ModelAPI.modelAPI_ResultPart(self._feature.firstResult())
42         return result_part.partDoc()