Page 1 of 1

Loading problems

Posted: Wed May 18, 2022 8:28 pm
by iplayfast
My initialization code works fine when I create the object, but when I reload from disk, the gear_box_obj is decoupled from the GearBoxParameters.

This is the code that I initialize with.

Code: Select all

        doc = App.ActiveDocument
        body = doc.addObject('PartDesign::Body', 'gear_box')        
        gear_box_obj = doc.addObject("Part::FeaturePython", "GearBoxParameters")
        gear_box = CycloidalGearBox(gear_box_obj)        
CycloidalGearBox is a class that adds attributes to gear_box_obj and adds the object to itself for reference.

Code: Select all

class CycloidalGearBox():
    def __init__(self, obj):     
        obj.addProperty("App::PropertyLength", "clearance", "CycloidGearBox", QT_TRANSLATE_NOOP(
            "App::Property", "clearance between parts")).clearance = H["clearance"]
        self.Type = 'CycloidalGearBox'
        self.Object = obj
        self.doc = App.ActiveDocument
        obj.Proxy = self
        attrs = vars(self)
I'm sure that I'm not doing this properly.
Thanks in advance for helping.