Repository: FreeCAD/FreeCAD
File: src/Mod/BIM/ArchWindow.py (Python)

Code before:
        sillProp = ["baseSill", "basePosZ", "atthOffZ"]
        for i in sillProp:
            if i not in prop:
                obj.addProperty("App::PropertyPythonObject", i)

    def onDocumentRestored(self, obj):

        ArchComponent.Component.onDocumentRestored(self, obj)
        self.setProperties(obj, mode="ODR")

        # Add features in the SketchArch External Add-on
        self.addSketchArchFeatures(obj, mode="ODR")

        # TODO 2025.6.27 : Seems SillHeight already triggered onChanged() upon document restored - NO need codes below in onDocumentRestored()
        # Need to restore 'initial' settings as corresponding codes in onChanged() does upon object creation
        # self.baseSill = obj.SillHeight.Value
        # self.basePos = obj.Base.Placement.Base
        # self.atthOff = None
        # if hasattr(obj, 'AttachmentOffsetXyzAndRotation'):
        #    self.atthOff = obj.AttachmentOffsetXyzAndRotation.Base

        # Sill -> SillHeight property rename migration
        if hasattr(obj, "Sill"):
            obj.SillHeight = obj.Sill
            obj.removeProperty("Sill")

    def loads(self, state):

        self.Type = "Window"

    def onBeforeChange(self, obj, prop):

        if prop in ["Base", "WindowParts", "Placement", "HoleDepth", "Height", "Width", "Hosts"]:
            setattr(self, prop, getattr(obj, prop))
        if prop in ["Height", "Width"] and obj.CloneOf is None:
            self.TouchOnShapeChange = True  # touch hosts after next "Shape" change

    def onChanged(self, obj, prop):

        self.hideSubobjects(obj, prop)
        if prop == "SillHeight":
            self.setSillProperties(obj)  # Can't wait until onDocumentRestored
            self.onSillHeightChanged(obj)
        elif not "Restore" in obj.State:
            if prop in [
                "Base",
                "WindowParts",
                "Placement",
                "HoleDepth",
                "Height",
                "Width",

Review comment (suggestion):
```suggestion
            obj.setPropertyStatus(prop, "-LockDynamic")
            obj.removeProperty("Sill")
```

Code after:
        sillProp = ["baseSill", "basePosZ", "atthOffZ"]
        for i in sillProp:
            if i not in prop:
                obj.addProperty("App::PropertyPythonObject", i)

    def onDocumentRestored(self, obj):

        ArchComponent.Component.onDocumentRestored(self, obj)
        self.setProperties(obj, mode="ODR")

        # Add features in the SketchArch External Add-on
        self.addSketchArchFeatures(obj, mode="ODR")

        # TODO 2025.6.27 : Seems SillHeight already triggered onChanged() upon document restored - NO need codes below in onDocumentRestored()
        # Need to restore 'initial' settings as corresponding codes in onChanged() does upon object creation
        # self.baseSill = obj.SillHeight.Value
        # self.basePos = obj.Base.Placement.Base
        # self.atthOff = None
        # if hasattr(obj, 'AttachmentOffsetXyzAndRotation'):
        #    self.atthOff = obj.AttachmentOffsetXyzAndRotation.Base

        # Sill -> SillHeight property rename migration
        if hasattr(obj, "Sill"):
            obj.SillHeight = obj.Sill
            obj.setPropertyStatus(prop, "-LockDynamic")
            obj.removeProperty("Sill")

    def loads(self, state):

        self.Type = "Window"

    def onBeforeChange(self, obj, prop):

        if prop in ["Base", "WindowParts", "Placement", "HoleDepth", "Height", "Width", "Hosts"]:
            setattr(self, prop, getattr(obj, prop))
        if prop in ["Height", "Width"] and obj.CloneOf is None:
            self.TouchOnShapeChange = True  # touch hosts after next "Shape" change

    def onChanged(self, obj, prop):

        self.hideSubobjects(obj, prop)
        if prop == "SillHeight":
            self.setSillProperties(obj)  # Can't wait until onDocumentRestored
            self.onSillHeightChanged(obj)
        elif not "Restore" in obj.State:
            if prop in [
                "Base",
                "WindowParts",
                "Placement",
                "HoleDepth",
                "Height",