Skip to content

Commit

Permalink
Simplified orphans handling - fixes @27
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Mar 18, 2024
1 parent 95e87f3 commit be713ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
8 changes: 2 additions & 6 deletions ifc_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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()
Expand All @@ -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)
Expand Down
11 changes: 2 additions & 9 deletions ifc_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit be713ee

Please sign in to comment.