mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-07 21:06:25 +00:00
Support invalid empty IFC properties coming from ArchiCAD. See #1131.
This commit is contained in:
@@ -1428,10 +1428,17 @@ class IfcImporter:
|
|||||||
for prop_name in ifcopenshell.util.pset.psets[new_pset.name]["HasPropertyTemplates"].keys():
|
for prop_name in ifcopenshell.util.pset.psets[new_pset.name]["HasPropertyTemplates"].keys():
|
||||||
prop = new_pset.properties.add()
|
prop = new_pset.properties.add()
|
||||||
prop.name = prop_name
|
prop.name = prop_name
|
||||||
|
try:
|
||||||
|
if hasattr(pset, "HasProperties"):
|
||||||
|
props = pset.HasProperties
|
||||||
|
elif hasattr(pset, "Properties"):
|
||||||
|
props = pset.Properties
|
||||||
|
except:
|
||||||
|
return # I've seen ArchiCAD produce invalid IFCs with empty data
|
||||||
# Invalid IFC, but some vendors like Solidworks do this so we accomodate it
|
# Invalid IFC, but some vendors like Solidworks do this so we accomodate it
|
||||||
if not pset.HasProperties:
|
if not props:
|
||||||
return
|
return
|
||||||
for prop in pset.HasProperties:
|
for prop in props:
|
||||||
if prop.is_a("IfcPropertySingleValue") and prop.NominalValue:
|
if prop.is_a("IfcPropertySingleValue") and prop.NominalValue:
|
||||||
index = new_pset.properties.find(prop.Name)
|
index = new_pset.properties.find(prop.Name)
|
||||||
if index >= 0:
|
if index >= 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user