From dd525d8a30beed88ec018e05c6e7475ab64ca25c Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 14 May 2020 16:30:16 +1000 Subject: [PATCH] Fix bug where a subcontext is always assumed during import, causing a fail --- src/ifcblenderexport/blenderbim/bim/import_ifc.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index de77317bbc..d4f75bbfbb 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -635,10 +635,16 @@ class IfcImporter(): if not element.Representation: return for r in element.Representation.Representations: - subcontexts.append('{}/{}/{}'.format( - r.ContextOfItems.ContextType, - r.ContextOfItems.ContextIdentifier, - r.ContextOfItems.TargetView)) + if r.ContextOfItems.is_a('IfcGeometricRepresentationSubContext'): + subcontexts.append('{}/{}/{}'.format( + r.ContextOfItems.ContextType, + r.ContextOfItems.ContextIdentifier, + r.ContextOfItems.TargetView)) + else: + subcontexts.append('{}/{}/{}'.format( + r.ContextOfItems.ContextType, + r.ContextOfItems.ContextIdentifier, + None)) elif element.is_a('IfcTypeProduct'): if not element.RepresentationMaps: return