From be713eeb5746c9e731a72348f30f7440a9730401 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 18 Mar 2024 16:35:07 +0100 Subject: [PATCH] Simplified orphans handling - fixes @27 --- ifc_import.py | 8 ++------ ifc_tools.py | 11 ++--------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/ifc_import.py b/ifc_import.py index 8046724..05a96e5 100644 --- a/ifc_import.py +++ b/ifc_import.py @@ -76,7 +76,7 @@ def insert( prj_obj = ifc_tools.create_document_object( document, filename, shapemode, strategy ) - if params.GetBool("LoadOrphans", False): + if params.GetBool("LoadOrphans", True): ifc_tools.load_orphans(prj_obj) if not silent and params.GetBool("LoadMaterials", False): ifc_materials.load_materials(prj_obj) @@ -107,7 +107,7 @@ def insert( def get_options( - strategy=None, shapemode=None, switchwb=None, silent=False, orphans=None + strategy=None, shapemode=None, switchwb=None, silent=False ): """Shows a dialog to get import options @@ -119,7 +119,6 @@ def get_options( 2 = all children """ - orphans = params.GetBool("LoadOrphans", False) psets = params.GetBool("LoadPsets", False) materials = params.GetBool("LoadMaterials", False) layers = params.GetBool("LoadLayers", False) @@ -145,7 +144,6 @@ def get_options( dlg.comboShapeMode.setCurrentIndex(shapemode) dlg.checkSwitchWB.setChecked(switchwb) dlg.checkAskAgain.setChecked(ask) - dlg.checkLoadOrphans.setChecked(orphans) dlg.checkLoadPsets.setChecked(psets) dlg.checkLoadMaterials.setChecked(materials) dlg.checkLoadLayers.setChecked(layers) @@ -157,7 +155,6 @@ def get_options( shapemode = dlg.comboShapeMode.currentIndex() switchwb = dlg.checkSwitchWB.isChecked() ask = dlg.checkAskAgain.isChecked() - orphans = dlg.checkLoadOrphans.isChecked() psets = dlg.checkLoadPsets.isChecked() materials = dlg.checkLoadMaterials.isChecked() layers = dlg.checkLoadLayers.isChecked() @@ -166,7 +163,6 @@ def get_options( params.SetInt("ShapeMode", shapemode) params.SetBool("SwitchWB", switchwb) params.SetBool("AskAgain", ask) - params.SetBool("LoadOrphans", orphans) params.SetBool("LoadPsets", psets) params.SetBool("LoadMaterials", materials) params.SetBool("LoadLayers", layers) diff --git a/ifc_tools.py b/ifc_tools.py index 70d9b7f..4962ea5 100644 --- a/ifc_tools.py +++ b/ifc_tools.py @@ -1215,12 +1215,5 @@ def load_orphans(obj): ifcfile = get_ifcfile(obj) shapemode = obj.ShapeMode elements = get_orphan_elements(ifcfile) - if elements: - if PARAMS.GetBool("SingleDoc", False): - for element in elements: - child = create_object(element, doc, ifcfile, shapemode) - else: - group = get_group(obj, "IfcOrphansGroup") - for element in elements: - child = create_object(element, doc, ifcfile, shapemode) - group.addObject(child) + for element in elements: + child = create_object(element, doc, ifcfile, shapemode)