1 """Registration of all user-defined Python features
5 from macros.box.feature import BoxFeature
6 from macros.rectangle.feature import SketchPlugin_Rectangle
9 class PythonFeaturesPlugin(ModelAPI.ModelAPI_Plugin):
10 """Implementation of features plugin.
12 PythonFeaturesPlugin() -> plugin object
16 """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
17 ModelAPI.ModelAPI_Plugin.__init__(self)
18 aSession = ModelAPI.ModelAPI_Session.get()
19 aSession.registerPlugin(self)
22 def createFeature(self, theFeatureID):
23 """Override ModelAPI_Plugin.createFeature()"""
26 if theFeatureID == BoxFeature.ID():
27 aFeature = BoxFeature().__disown__()
29 elif theFeatureID == SketchPlugin_Rectangle.ID():
30 aFeature = SketchPlugin_Rectangle().__disown__()
33 raise StandardError("No such feature %s" % theFeatureID)
38 plugin = PythonFeaturesPlugin()