diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index 721bd1f9c..caf803a21 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -662,9 +662,10 @@ def getHost(obj,strict=True): return par return None -def pruneIncluded(objectslist): - """pruneIncluded(objectslist): removes from a list of Arch objects, those that are subcomponents of - another shape-based object, leaving only the top-level shapes.""" +def pruneIncluded(objectslist,strict=False): + """pruneIncluded(objectslist,[strict]): removes from a list of Arch objects, those that are subcomponents of + another shape-based object, leaving only the top-level shapes. If strict is True, the object + is removed only if the parent is also part of the selection.""" import Draft newlist = [] for obj in objectslist: @@ -683,6 +684,9 @@ def pruneIncluded(objectslist): toplevel = False else: toplevel = False + if (toplevel == False) and strict: + if not(parent in objectslist) and not(parent in newlist): + toplevel = True if toplevel: newlist.append(obj) return newlist diff --git a/src/Mod/Arch/ArchSchedule.py b/src/Mod/Arch/ArchSchedule.py index 41ad91105..dd71aea5e 100644 --- a/src/Mod/Arch/ArchSchedule.py +++ b/src/Mod/Arch/ArchSchedule.py @@ -119,7 +119,7 @@ class _ArchSchedule: if objs[0].isDerivedFrom("App::DocumentObjectGroup"): objs = objs[0].Group objs = Draft.getGroupContents(objs,walls=True,addgroups=True) - objs = Arch.pruneIncluded(objs) + objs = Arch.pruneIncluded(objs,strict=True) if obj.Filter[i]: # apply filters nobjs = []