mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
You can now easily open associated documents with support for inherited locations
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import os
|
||||||
import bpy
|
import bpy
|
||||||
import ifcopenshell
|
import ifcopenshell
|
||||||
import ifcopenshell.util.schema
|
import ifcopenshell.util.schema
|
||||||
@@ -85,12 +86,20 @@ class ObjectDocumentData:
|
|||||||
identification = rel.RelatingDocument.ItemReference
|
identification = rel.RelatingDocument.ItemReference
|
||||||
else:
|
else:
|
||||||
identification = rel.RelatingDocument.Identification
|
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(
|
results.append(
|
||||||
{
|
{
|
||||||
"type": rel.RelatingDocument.is_a(),
|
|
||||||
"id": rel.RelatingDocument.id(),
|
"id": rel.RelatingDocument.id(),
|
||||||
"identification": identification,
|
"identification": identification,
|
||||||
"name": rel.RelatingDocument.Name,
|
"name": rel.RelatingDocument.Name,
|
||||||
|
"location": location,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
return results
|
return results
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ class BIM_PT_object_documents(Panel):
|
|||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.label(text=document["identification"] or "*", icon="FILE")
|
row.label(text=document["identification"] or "*", icon="FILE")
|
||||||
row.label(text=document["name"] or "Unnamed")
|
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"]
|
row.operator("bim.unassign_document", text="", icon="X").document = document["id"]
|
||||||
|
|
||||||
def draw_add_ui(self):
|
def draw_add_ui(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user