BIM: fix deletion of BuildingPart in strict IFC mode (#26219)

* BIM: fix deletion of BuildingPart in strict IFC mode

Add `sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()` to `onDelete`.

* BIM: fix deletion of BuildingPart in strict IFC mode

Explicitly call `obj.ViewObject.Proxy.attach(obj.ViewObject)`.

* BIM: fix deletion of BuildingPart in strict IFC mode

In `ifc_vp_buildingpart` call `attach` from `ArchBuildingPart.ViewProviderBuildingPart`.
This commit is contained in:
Roy-043
2025-12-22 03:16:17 +01:00
committed by GitHub
parent dc896b58ca
commit 584614bb01
3 changed files with 5 additions and 0 deletions

View File

@@ -1112,6 +1112,7 @@ class ViewProviderBuildingPart:
def onDelete(self, vobj, subelements):
if self.clip:
sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
sg.removeChild(self.clip)
self.clip = None
for o in Draft.get_group_contents(vobj.Object.Group, walls=True):

View File

@@ -575,6 +575,7 @@ def add_object(document, otype=None, oname="IfcObject"):
obj.ViewObject.ShowLevel = False
obj.ViewObject.ShowLabel = False
obj.ViewObject.Proxy = ifc_viewproviders.ifc_vp_buildingpart(obj.ViewObject)
obj.ViewObject.Proxy.attach(obj.ViewObject)
for p in obj.PropertiesList:
if obj.getGroupOfProperty(p) in ["BuildingPart", "IFC Attributes", "Children"]:
obj.removeProperty(p)

View File

@@ -620,6 +620,9 @@ class ifc_vp_buildingpart(ifc_vp_object, ArchBuildingPart.ViewProviderBuildingPa
def __init__(self, vobj):
ArchBuildingPart.ViewProviderBuildingPart.__init__(self, vobj)
def attach(self, vobj):
ArchBuildingPart.ViewProviderBuildingPart.attach(self, vobj)
def overlay(icon1, icon2):
"""Overlays icon2 onto icon1"""