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