From 2c8b09bec4fa184b967c491ec1013a5e4fc4d487 Mon Sep 17 00:00:00 2001 From: Jarno de Wit <83075367+Jarno-de-Wit@users.noreply.github.com> Date: Tue, 5 Nov 2024 14:44:18 +0100 Subject: [PATCH] Fix excessive selection pruning in dae exporter for PartDesign Objects (#17529) (#17654) * Fixes excessive export selection pruning for PartDesign objects (#17529) * Raises selection prune message log-level from Log to Warning (#17529) --- src/Mod/BIM/ArchCommands.py | 5 ++++- src/Mod/BIM/importers/importDAE.py | 4 ++-- src/Mod/BIM/importers/importIFClegacy.py | 2 +- src/Mod/BIM/importers/importOBJ.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Mod/BIM/ArchCommands.py b/src/Mod/BIM/ArchCommands.py index 9d8a5cd1b3..0fcf737765 100644 --- a/src/Mod/BIM/ArchCommands.py +++ b/src/Mod/BIM/ArchCommands.py @@ -770,6 +770,9 @@ def pruneIncluded(objectslist,strict=False): elif parent.isDerivedFrom("PartDesign::Body") and obj == parent.BaseFeature: # don't consider a PartDesign_Body with a PartDesign_Clone that references obj pass + elif parent.isDerivedFrom("PartDesign::SubShapeBinder") or (hasattr(parent, "TypeId") and parent.TypeId == "PartDesign::ShapeBinder"): + # don't consider a PartDesign_SubShapeBinder or PartDesign_ShapeBinder referncing this object from another object + pass elif hasattr(parent,"Host") and parent.Host == obj: pass elif hasattr(parent,"Hosts") and obj in parent.Hosts: @@ -791,7 +794,7 @@ def pruneIncluded(objectslist,strict=False): if toplevel: newlist.append(obj) else: - FreeCAD.Console.PrintLog("pruning "+obj.Label+"\n") + FreeCAD.Console.PrintWarning("pruning "+obj.Label+"\n") return newlist def getAllChildren(objectlist): diff --git a/src/Mod/BIM/importers/importDAE.py b/src/Mod/BIM/importers/importDAE.py index 8cd5464680..4c979061fd 100644 --- a/src/Mod/BIM/importers/importDAE.py +++ b/src/Mod/BIM/importers/importDAE.py @@ -205,7 +205,7 @@ def export(exportList,filename,tessellation=1,colors=None): scenenodes = [] objectslist = Draft.get_group_contents(exportList, walls=True, addgroups=True) - objectslist = Arch.pruneIncluded(objectslist) + objectslist = Arch.pruneIncluded(objectslist, strict=True) for obj in objectslist: findex = numpy.array([]) m = None @@ -308,4 +308,4 @@ def export(exportList,filename,tessellation=1,colors=None): colmesh.scenes.append(myscene) colmesh.scene = myscene colmesh.write(filename) - FreeCAD.Console.PrintMessage(translate("Arch","file %s successfully created.") % filename) + FreeCAD.Console.PrintMessage(translate("Arch","file %s successfully created.") % filename + "\n") diff --git a/src/Mod/BIM/importers/importIFClegacy.py b/src/Mod/BIM/importers/importIFClegacy.py index ebf4841376..5c04548c4c 100644 --- a/src/Mod/BIM/importers/importIFClegacy.py +++ b/src/Mod/BIM/importers/importIFClegacy.py @@ -956,7 +956,7 @@ def export(exportList,filename): # get all children and reorder list to get buildings and floors processed first objectslist = Draft.get_group_contents(exportList, walls=True, addgroups=True) - objectslist = Arch.pruneIncluded(objectslist) + objectslist = Arch.pruneIncluded(objectslist, strict=True) sites = [] buildings = [] diff --git a/src/Mod/BIM/importers/importOBJ.py b/src/Mod/BIM/importers/importOBJ.py index 214eeced36..8533ad578a 100644 --- a/src/Mod/BIM/importers/importOBJ.py +++ b/src/Mod/BIM/importers/importOBJ.py @@ -148,7 +148,7 @@ def export(exportList,filename,colors=None): offsetvn = 1 objectslist = Draft.get_group_contents(exportList, walls=True, addgroups=True) - objectslist = Arch.pruneIncluded(objectslist) + objectslist = Arch.pruneIncluded(objectslist, strict=True) filenamemtl = filename[:-4] + ".mtl" materials = [] outfile.write("mtllib " + os.path.basename(filenamemtl) + "\n")