diff --git a/src/blenderbim/blenderbim/bim/module/document/data.py b/src/blenderbim/blenderbim/bim/module/document/data.py index bd15c610ac..136fa2f3a4 100644 --- a/src/blenderbim/blenderbim/bim/module/document/data.py +++ b/src/blenderbim/blenderbim/bim/module/document/data.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with BlenderBIM Add-on. If not, see . +import os import bpy import ifcopenshell import ifcopenshell.util.schema @@ -85,12 +86,20 @@ class ObjectDocumentData: identification = rel.RelatingDocument.ItemReference else: identification = rel.RelatingDocument.Identification + location = rel.RelatingDocument.Location + if location is None and rel.RelatingDocument.ReferencedDocument: + location = rel.RelatingDocument.ReferencedDocument.Location + if location: + if not "://" in location: + 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( { - "type": rel.RelatingDocument.is_a(), "id": rel.RelatingDocument.id(), "identification": identification, "name": rel.RelatingDocument.Name, + "location": location, } ) return results diff --git a/src/blenderbim/blenderbim/bim/module/document/ui.py b/src/blenderbim/blenderbim/bim/module/document/ui.py index 71a0ca04cd..74a8f7cf2b 100644 --- a/src/blenderbim/blenderbim/bim/module/document/ui.py +++ b/src/blenderbim/blenderbim/bim/module/document/ui.py @@ -113,6 +113,8 @@ class BIM_PT_object_documents(Panel): row = self.layout.row(align=True) row.label(text=document["identification"] or "*", icon="FILE") row.label(text=document["name"] or "Unnamed") + if document["location"]: + row.operator("bim.open_uri", icon="URL", text="").uri = document["location"] row.operator("bim.unassign_document", text="", icon="X").document = document["id"] def draw_add_ui(self):