mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Import all document association metadata, not just location
This commit is contained in:
@@ -158,6 +158,7 @@ if bpy is not None:
|
||||
ui.BIM_PT_mesh,
|
||||
ui.BIM_PT_object,
|
||||
ui.BIM_PT_classification_references,
|
||||
ui.BIM_PT_documents,
|
||||
ui.BIM_PT_camera,
|
||||
ui.BIM_UL_topics,
|
||||
ui.BIM_UL_classifications,
|
||||
|
||||
@@ -887,9 +887,18 @@ class IfcImporter():
|
||||
def add_element_document_relations(self, element, obj):
|
||||
for association in element.HasAssociations:
|
||||
if association.is_a('IfcRelAssociatesDocument'):
|
||||
document_reference = association.RelatingDocument
|
||||
data = association.RelatingDocument
|
||||
document = obj.BIMObjectProperties.documents.add()
|
||||
document.file = document_reference.Location
|
||||
data_map = {
|
||||
'file': 'Location',
|
||||
'location': 'Location',
|
||||
'identification': 'Identification',
|
||||
'name': 'Name',
|
||||
'description': 'Description'
|
||||
}
|
||||
for key, value in data_map.items():
|
||||
if hasattr(data, value) and getattr(data, value):
|
||||
setattr(document, key, getattr(data, value))
|
||||
|
||||
def place_objects_in_spatial_tree(self):
|
||||
for global_id, obj in self.added_data.items():
|
||||
|
||||
@@ -927,8 +927,13 @@ class PsetQto(PropertyGroup):
|
||||
file: StringProperty(name="File")
|
||||
properties: CollectionProperty(name="Properties", type=Attribute)
|
||||
|
||||
|
||||
class Document(PropertyGroup):
|
||||
file: StringProperty(name="File")
|
||||
location: StringProperty(name="Location")
|
||||
identification: StringProperty(name="Identification")
|
||||
name: StringProperty(name="Name")
|
||||
description: StringProperty(name="Description")
|
||||
|
||||
|
||||
class GlobalId(PropertyGroup):
|
||||
|
||||
@@ -81,22 +81,6 @@ class BIM_PT_object(Panel):
|
||||
row.prop(prop, 'name', text='')
|
||||
row.prop(prop, 'string_value', text='')
|
||||
|
||||
layout.label(text="Documents:")
|
||||
row = layout.row(align=True)
|
||||
row.prop(props, 'applicable_documents', text='')
|
||||
row.operator('bim.add_document')
|
||||
|
||||
row = layout.row()
|
||||
row.operator('bim.fetch_object_passport')
|
||||
|
||||
for index, document in enumerate(props.documents):
|
||||
row = layout.row(align=True)
|
||||
row.prop(document, 'file', text='')
|
||||
row.operator('bim.remove_document', icon='X', text='').document_index = index
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'documents')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'material_type')
|
||||
|
||||
@@ -117,6 +101,42 @@ class BIM_PT_object(Panel):
|
||||
row.prop(props, 'structural_member_connection')
|
||||
|
||||
|
||||
class BIM_PT_documents(Panel):
|
||||
bl_label = 'Documents'
|
||||
bl_idname = 'BIM_PT_documents'
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_space_type = 'PROPERTIES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = 'object'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
props = context.active_object.BIMObjectProperties
|
||||
|
||||
if not props.documents:
|
||||
layout.label(text="No documents found")
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(props, 'applicable_documents', text='')
|
||||
row.operator('bim.add_document')
|
||||
|
||||
row = layout.row()
|
||||
row.operator('bim.fetch_object_passport')
|
||||
|
||||
for index, document in enumerate(props.documents):
|
||||
row = layout.row(align=True)
|
||||
row.prop(document, 'identification')
|
||||
row.operator('bim.remove_document', icon='X', text='').document_index = index
|
||||
row = layout.row(align=True)
|
||||
row.prop(document, 'file')
|
||||
row = layout.row(align=True)
|
||||
row.prop(document, 'location')
|
||||
row = layout.row(align=True)
|
||||
row.prop(document, 'name')
|
||||
row = layout.row(align=True)
|
||||
row.prop(document, 'description')
|
||||
|
||||
|
||||
class BIM_PT_classification_references(Panel):
|
||||
bl_label = 'Classification References'
|
||||
bl_idname = 'BIM_PT_classification_references'
|
||||
@@ -129,7 +149,8 @@ class BIM_PT_classification_references(Panel):
|
||||
layout = self.layout
|
||||
props = context.active_object.BIMObjectProperties
|
||||
|
||||
layout.label(text="Classification:")
|
||||
if not props.classifications:
|
||||
layout.label(text="No classifications found")
|
||||
|
||||
for index, classification in enumerate(props.classifications):
|
||||
row = layout.row(align=True)
|
||||
@@ -144,9 +165,6 @@ class BIM_PT_classification_references(Panel):
|
||||
row = layout.row(align=True)
|
||||
row.prop(classification, 'referenced_source')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'classifications')
|
||||
|
||||
|
||||
class BIM_PT_psets(Panel):
|
||||
bl_label = 'Psets'
|
||||
|
||||
Reference in New Issue
Block a user