From 9d3a988cdaf78a84e6fdbc3f1654a7346d8146cc Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 26 Jan 2019 13:35:17 +1100 Subject: [PATCH] Update ArchComponent and importIFC to use values from the new ifc_products dictionary --- src/Mod/Arch/ArchComponent.py | 8 ++++---- src/Mod/Arch/importIFC.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 4c3e852e17..2ae67c0c39 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -61,12 +61,12 @@ with open(os.path.join(FreeCAD.getResourceDir(),"Mod","Arch","Presets","ifc_prod ifcProducts = json.load(f) # Possible roles for FreeCAD BIM objects -IfcRoles = ['Undefined']+[''.join(map(lambda x: x if x.islower() else " "+x, t[3:]))[1:] for t in [product["name"] for product in ifcProducts]] +IfcRoles = ['Undefined']+[''.join(map(lambda x: x if x.islower() else " "+x, t[3:]))[1:] for t in ifcProducts.keys()] def getIfcProduct(IfcRole): - for ifcProduct in ifcProducts: - if ifcProduct["name"] == 'Ifc' + IfcRole.replace(' ', ''): - return ifcProduct + name = "Ifc" + IfcRole.replace(" ", "") + if name in ifcProducts: + return ifcProducts[name] def getIfcProductAttribute(ifcProduct, name): for attribute in ifcProduct["attributes"]: diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index 9734ba2965..b4212bca6b 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -1724,8 +1724,8 @@ def export(exportList,filename): count += 1 continue - from ArchComponent import IFCTYPES - if ifctype not in IFCTYPES: + from ArchComponent import ifcProducts + if ifctype not in ifcProducts.keys(): ifctype = "IfcBuildingElementProxy" # getting the "Force BREP" flag