From eea7b6547efd79fb20f4bdc43009f47cb7b81aad Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 28 Aug 2020 08:24:32 +1000 Subject: [PATCH] Fix bug where mapped representations belonging to a context fails to import --- 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 591cee13d1..6d47bc948f 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -1233,10 +1233,16 @@ class IfcImporter(): if not element.RepresentationMaps: return for r in element.RepresentationMaps: - subcontexts.append('{}/{}/{}'.format( - r.MappedRepresentation.ContextOfItems.ContextType or '', - r.MappedRepresentation.ContextOfItems.ContextIdentifier or '', - r.MappedRepresentation.ContextOfItems.TargetView or '')) + if r.MappedRepresentation.ContextOfItems.is_a('IfcGeometricRepresentationSubContext'): + subcontexts.append('{}/{}/{}'.format( + r.MappedRepresentation.ContextOfItems.ContextType or '', + r.MappedRepresentation.ContextOfItems.ContextIdentifier or '', + r.MappedRepresentation.ContextOfItems.TargetView or '')) + else: + subcontexts.append('{}/{}/{}'.format( + r.MappedRepresentation.ContextOfItems.ContextType or '', + r.MappedRepresentation.ContextOfItems.ContextIdentifier or '', + '')) subcontexts = set(subcontexts) for subcontext in subcontexts: representation_context = obj.BIMObjectProperties.representation_contexts.add()