From 74e18a56ce1b7e8c25fe61e04b2eacada2941533 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Tue, 15 Mar 2022 19:53:56 +1100 Subject: [PATCH] Fall back to information data if reference data is null for associated documents. --- .../blenderbim/bim/module/document/data.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/blenderbim/blenderbim/bim/module/document/data.py b/src/blenderbim/blenderbim/bim/module/document/data.py index 136fa2f3a4..3b056bec32 100644 --- a/src/blenderbim/blenderbim/bim/module/document/data.py +++ b/src/blenderbim/blenderbim/bim/module/document/data.py @@ -82,10 +82,20 @@ class ObjectDocumentData: if rel.is_a("IfcRelAssociatesDocument"): if not rel.RelatingDocument.is_a("IfcDocumentReference"): continue + + name = rel.RelatingDocument.Name + if not name and rel.RelatingDocument.ReferencedDocument: + name = rel.RelatingDocument.ReferencedDocument.Name + if tool.Ifc.get_schema() == "IFC2X3": identification = rel.RelatingDocument.ItemReference + if not identification and rel.RelatingDocument.ReferencedDocument: + identification = rel.RelatingDocument.ReferencedDocument.DocumentId else: identification = rel.RelatingDocument.Identification + if not identification and rel.RelatingDocument.ReferencedDocument: + identification = rel.RelatingDocument.ReferencedDocument.Identification + location = rel.RelatingDocument.Location if location is None and rel.RelatingDocument.ReferencedDocument: location = rel.RelatingDocument.ReferencedDocument.Location @@ -94,11 +104,12 @@ class ObjectDocumentData: if not os.path.isabs(location): location = os.path.abspath(os.path.join(os.path.dirname(tool.Ifc.get_path()), location)) location = "file://" + location + results.append( { "id": rel.RelatingDocument.id(), "identification": identification, - "name": rel.RelatingDocument.Name, + "name": name, "location": location, } )