From 2050ac6b50ceec94476eb03d8579cf5ed4b1ded8 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 11 Apr 2019 16:40:59 -0300 Subject: [PATCH] Arch: Misc dynamic properties-related bugfixes to IFC exporter --- src/Mod/Arch/importIFC.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index 003abb1501..74b25d0c66 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -837,8 +837,11 @@ def insert(filename,docname,skip=[],only=[],root=None): a = obj.IfcData a["IfcUID"] = str(guid) obj.IfcData = a + + # setting IFC attributes + for attribute in ArchIFCSchema.IfcProducts[product.is_a()]["attributes"]: - if hasattr(product, attribute["name"]) and getattr(product, attribute["name"]): + if hasattr(product, attribute["name"]) and getattr(product, attribute["name"]) and hasattr(obj,attribute["name"]): setattr(obj, attribute["name"], getattr(product, attribute["name"])) if obj: @@ -1842,6 +1845,11 @@ def export(exportList,filename): pvalue = True else: pvalue = False + elif ptype == "IfcLogical": + if pvalue.upper() == "TRUE": + pvalue = True + else: + pvalue = False elif ptype == "IfcInteger": pvalue = int(pvalue) else: @@ -2407,6 +2415,8 @@ def exportIfcAttributes(obj, kwargs): value = obj.getPropertyByName(property) if isinstance(value, FreeCAD.Units.Quantity): value = float(value) + if property in ["ElevationWithFlooring","Elevation"]: + value = value/1000 # some properties must be changed to meters kwargs.update({ property: value }) return kwargs