mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 01:50:02 +00:00
Fall back to information data if reference data is null for associated documents.
This commit is contained in:
@@ -82,10 +82,20 @@ class ObjectDocumentData:
|
|||||||
if rel.is_a("IfcRelAssociatesDocument"):
|
if rel.is_a("IfcRelAssociatesDocument"):
|
||||||
if not rel.RelatingDocument.is_a("IfcDocumentReference"):
|
if not rel.RelatingDocument.is_a("IfcDocumentReference"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
name = rel.RelatingDocument.Name
|
||||||
|
if not name and rel.RelatingDocument.ReferencedDocument:
|
||||||
|
name = rel.RelatingDocument.ReferencedDocument.Name
|
||||||
|
|
||||||
if tool.Ifc.get_schema() == "IFC2X3":
|
if tool.Ifc.get_schema() == "IFC2X3":
|
||||||
identification = rel.RelatingDocument.ItemReference
|
identification = rel.RelatingDocument.ItemReference
|
||||||
|
if not identification and rel.RelatingDocument.ReferencedDocument:
|
||||||
|
identification = rel.RelatingDocument.ReferencedDocument.DocumentId
|
||||||
else:
|
else:
|
||||||
identification = rel.RelatingDocument.Identification
|
identification = rel.RelatingDocument.Identification
|
||||||
|
if not identification and rel.RelatingDocument.ReferencedDocument:
|
||||||
|
identification = rel.RelatingDocument.ReferencedDocument.Identification
|
||||||
|
|
||||||
location = rel.RelatingDocument.Location
|
location = rel.RelatingDocument.Location
|
||||||
if location is None and rel.RelatingDocument.ReferencedDocument:
|
if location is None and rel.RelatingDocument.ReferencedDocument:
|
||||||
location = rel.RelatingDocument.ReferencedDocument.Location
|
location = rel.RelatingDocument.ReferencedDocument.Location
|
||||||
@@ -94,11 +104,12 @@ class ObjectDocumentData:
|
|||||||
if not os.path.isabs(location):
|
if not os.path.isabs(location):
|
||||||
location = os.path.abspath(os.path.join(os.path.dirname(tool.Ifc.get_path()), location))
|
location = os.path.abspath(os.path.join(os.path.dirname(tool.Ifc.get_path()), location))
|
||||||
location = "file://" + location
|
location = "file://" + location
|
||||||
|
|
||||||
results.append(
|
results.append(
|
||||||
{
|
{
|
||||||
"id": rel.RelatingDocument.id(),
|
"id": rel.RelatingDocument.id(),
|
||||||
"identification": identification,
|
"identification": identification,
|
||||||
"name": rel.RelatingDocument.Name,
|
"name": name,
|
||||||
"location": location,
|
"location": location,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user