Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom.git into Dev_1.1.0
[modules/shaper.git] / src / PythonAddons / addons_Features.py
1 """Registration of all user-defined Python features
2 """
3
4 import ModelAPI
5 from macros.box.feature      import BoxFeature
6 from macros.cylinder.feature import CylinderFeature
7
8
9 class PythonFeaturesPlugin(ModelAPI.ModelAPI_Plugin):
10
11     def __init__(self):
12         ModelAPI.ModelAPI_Plugin.__init__(self)
13         aSession = ModelAPI.ModelAPI_Session.get()
14         aSession.registerPlugin(self)
15         pass
16
17     def createFeature(self, theFeatureID):
18         aFeature = None
19
20         if theFeatureID == BoxFeature.ID():
21             aFeature = BoxFeature().__disown__()
22
23         elif theFeatureID == CylinderFeature.ID():
24             aFeature = CylinderFeature().__disown__()
25
26         else:
27             raise StandardError("No such feature %s" % theFeatureID)
28
29         return aFeature
30
31
32 plugin = PythonFeaturesPlugin()
33 plugin.__disown__()