So Draft.makeBSpline builds the BSpline using this bit of code:
Code: Select all
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",fname)
_BSpline(obj)
obj.Closed = closed
obj.Points = pointslist
obj.Support = support
...
if gui:
_ViewProviderWire(obj.ViewObject)
The problem is, if I try to write my own custom Part::Part2DObjectPython class, then use it as the basis for the BSpline object, the BSpline class methods override my methods. As a very abbreviated example:
Code: Select all
def create(points):
obj = FreeCAD.ActiveDocument.addObject('Part::2DObjectPython', 'myObject')
_MyCustomClass(obj, points)
class _MyCustomClass:
def __init__(self, obj, points):
obj.Proxy = self
self.Type = 'MyCustomClass'
self.Object = obj
_BSpline(obj)
obj.Points = points