diff --git a/src/ifcblenderexport/blenderbim/bim/__init__.py b/src/ifcblenderexport/blenderbim/bim/__init__.py index 0073aacb41..3c5dffb92f 100644 --- a/src/ifcblenderexport/blenderbim/bim/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/__init__.py @@ -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, diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index 909f4116f4..f5397da170 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -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(): diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index af9e14b5e6..4a6c4e1177 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -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): diff --git a/src/ifcblenderexport/blenderbim/bim/ui.py b/src/ifcblenderexport/blenderbim/bim/ui.py index 1384ddd63d..734fc4b3e5 100644 --- a/src/ifcblenderexport/blenderbim/bim/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/ui.py @@ -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'