Update ArchComponent and importIFC to use values from the new ifc_products dictionary

This commit is contained in:
Dion Moult
2019-01-26 13:35:17 +11:00
parent f097b3a2bf
commit 9d3a988cda
2 changed files with 6 additions and 6 deletions

View File

@@ -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"]:

View File

@@ -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