+++ /dev/null
-"""Part Feature Interface
-Author: Daniel Brunier-Coulin
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-import model # Required by the temporary implementation of result member function
-
-
-class Part():
-
- def __init__ (self, partset):
- """Adds a new Part to the given Partset and activates the Part."""
- self._feature = partset.addFeature("Part")
- self._feature.execute()
-
- def document (self):
- """Returns the Part document created by this feature."""
- #TODO: Get the document referenced by this feature
- return model.activeDocument()
\ No newline at end of file
--- /dev/null
+"""Package for PartSet plugin for the Parametric Geometry API of the Modeler.
+"""
+
+from part import addPart, duplicatePart, removePart
\ No newline at end of file
--- /dev/null
+"""Part Feature Interface
+Author: Daniel Brunier-Coulin
+Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+"""
+
+import ModelAPI
+
+from model.roots import Interface
+
+
+def addPart(partset):
+ """Add a Part feature to the Part and return Part.
+
+ Pass all args to Part __init__ function.
+ """
+ feature = partset.addFeature("Part")
+ return Part(feature)
+
+def duplicatePart(part):
+ """Create a copy of the Part."""
+ feature = part.addFeature("Duplicate")
+ feature.execute()
+ return Part(feature)
+
+def removePart(part):
+ """Remove the Part."""
+ feature = part.addFeature("Remove")
+ feature.execute()
+
+
+class Part(Interface):
+
+ def __init__(self, feature):
+ """Adds a new Part to the given Partset and activates the Part."""
+ Interface.__init__(self, feature)
+ assert(self._feature.getKind() == "Part")
+ pass
+
+ def document(self):
+ """Returns the Part document created by this feature."""
+ result_part = ModelAPI.modelAPI_ResultPart(self._feature.firstResult())
+ return result_part.partDoc()
+
+