Fix bug where mapped representations belonging to a context fails to import

This commit is contained in:
Dion Moult
2020-08-28 08:24:32 +10:00
parent 6cbf8cc8db
commit eea7b6547e
@@ -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()