diff --git a/src/ifcblenderexport/blenderbim/bim/__init__.py b/src/ifcblenderexport/blenderbim/bim/__init__.py index 3c5dffb92f..a97648852a 100644 --- a/src/ifcblenderexport/blenderbim/bim/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/__init__.py @@ -53,6 +53,8 @@ if bpy is not None: operator.RemoveQto, operator.AddMaterialPset, operator.RemoveMaterialPset, + operator.AddDocumentInformation, + operator.RemoveDocumentInformation, operator.AddDocument, operator.RemoveDocument, operator.GenerateGlobalId, @@ -116,6 +118,7 @@ if bpy is not None: prop.ClassificationView, prop.PropertySetTemplate, prop.PropertyTemplate, + prop.DocumentInformation, prop.BcfTopic, prop.BcfTopicLabel, prop.BcfTopicFile, @@ -144,6 +147,7 @@ if bpy is not None: ui.BIM_PT_bim, ui.BIM_PT_psets, ui.BIM_PT_classifications, + ui.BIM_PT_document_information, ui.BIM_PT_search, ui.BIM_PT_ifccsv, ui.BIM_PT_bcf, @@ -160,6 +164,7 @@ if bpy is not None: ui.BIM_PT_classification_references, ui.BIM_PT_documents, ui.BIM_PT_camera, + ui.BIM_UL_document_information, ui.BIM_UL_topics, ui.BIM_UL_classifications, ui.BIM_ADDON_preferences, diff --git a/src/ifcblenderexport/blenderbim/bim/export_ifc.py b/src/ifcblenderexport/blenderbim/bim/export_ifc.py index 5a828110e1..af436a28c9 100644 --- a/src/ifcblenderexport/blenderbim/bim/export_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/export_ifc.py @@ -137,6 +137,7 @@ class IfcParser(): unique_objects = self.add_spatial_elements_if_unselected(selected_objects) self.categorise_selected_objects(unique_objects) self.material_psets = self.get_material_psets() + self.document_information = self.get_document_information() self.documents = self.get_documents() self.classifications = self.get_classifications() self.classification_references = self.get_classification_references() @@ -686,6 +687,37 @@ class IfcParser(): }} return documents + def get_document_information(self): + results = {} + for information in bpy.context.scene.BIMProperties.document_information: + data_map = { + 'name': 'Identification', + 'human_name': 'Name', + 'description': 'Description', + 'location': 'Location', + 'purpose': 'Purpose', + 'intended_use': 'IntendedUse', + 'scope': 'Scope', + 'revision': 'Revision', + 'creation_time': 'CreationTime', + 'last_revision_time': 'LastRevisionTime', + 'electronic_format': 'ElectronicFormat', + 'valid_from': 'ValidFrom', + 'valid_until': 'ValidUntil', + 'confidentiality': 'Confidentiality', + 'status': 'Status' + } + attributes = {} + for key, value in data_map.items(): + if getattr(information, key): + attributes[value] = getattr(information, key) + results[information.name] = { + 'ifc': None, + 'raw': information, + 'attributes': attributes + } + return results + def get_project(self): for collection in bpy.data.collections: if self.is_a_project(self.get_ifc_class(collection.name)): @@ -1107,6 +1139,7 @@ class IfcExporter(): self.create_rep_context() self.create_project() self.create_library_information() + self.create_document_information() self.create_documents() self.create_classifications() self.create_classification_references() @@ -1301,6 +1334,11 @@ class IfcExporter(): [self.ifc_parser.project['ifc']], information['ifc']) + def create_document_information(self): + for information in self.ifc_parser.document_information.values(): + information['ifc'] = self.file.create_entity( + 'IfcDocumentInformation', **information['attributes']) + def create_documents(self): for document in self.ifc_parser.documents.values(): document['ifc'] = self.file.create_entity( diff --git a/src/ifcblenderexport/blenderbim/bim/import_ifc.py b/src/ifcblenderexport/blenderbim/bim/import_ifc.py index 4aa6ff23e9..2a779e583c 100644 --- a/src/ifcblenderexport/blenderbim/bim/import_ifc.py +++ b/src/ifcblenderexport/blenderbim/bim/import_ifc.py @@ -461,7 +461,6 @@ class IfcImporter(): if element.is_a('IfcReinforcingBar'): mesh = self.create_mesh(element, shape, is_curve=True) mesh.bevel_depth = self.native_elements[element.GlobalId]['radius'] - mesh.use_fill_caps = True else: mesh = self.create_mesh(element, shape) self.meshes[mesh_name] = mesh diff --git a/src/ifcblenderexport/blenderbim/bim/operator.py b/src/ifcblenderexport/blenderbim/bim/operator.py index 64517f64ee..508401d110 100644 --- a/src/ifcblenderexport/blenderbim/bim/operator.py +++ b/src/ifcblenderexport/blenderbim/bim/operator.py @@ -2236,3 +2236,22 @@ class SelectSimilarType(bpy.types.Operator): if obj.BIMObjectProperties.relating_type == relating_type: obj.select_set(True) return {'FINISHED'} + + +class AddDocumentInformation(bpy.types.Operator): + bl_idname = 'bim.add_document_information' + bl_label = 'Add Document Information' + + def execute(self, context): + info = bpy.context.scene.BIMProperties.document_information.add() + info.name = 'New Document ID' + return {'FINISHED'} + +class RemoveDocumentInformation(bpy.types.Operator): + bl_idname = 'bim.remove_document_information' + bl_label = 'Remove Document Information' + index: bpy.props.IntProperty() + + def execute(self, context): + bpy.context.scene.BIMProperties.document_information.remove(self.index) + return {'FINISHED'} diff --git a/src/ifcblenderexport/blenderbim/bim/prop.py b/src/ifcblenderexport/blenderbim/bim/prop.py index 4a6c4e1177..c940c648a7 100644 --- a/src/ifcblenderexport/blenderbim/bim/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/prop.py @@ -400,6 +400,39 @@ class BIMCameraProperties(PropertyGroup): is_nts: BoolProperty(name='Is NTS') +class DocumentInformation(PropertyGroup): + name: StringProperty(name='Identification') + human_name: StringProperty(name='Name') + description: StringProperty(name='Description') + location: StringProperty(name='Location') + purpose: StringProperty(name='Purpose') + intended_use: StringProperty(name='Intended Use') + scope: StringProperty(name='Scope') + revision: StringProperty(name='Revision') + document_owner: StringProperty(name='Owner') + editors: StringProperty(name='Editors') + creation_time: StringProperty(name='Created On') + last_revision_time: StringProperty(name='Last Revised') + electronic_format: StringProperty(name='Format') + valid_from: StringProperty(name='Valid From') + valid_until: StringProperty(name='Valid Until') + confidentiality: EnumProperty(items=[ + ('NOTDEFINED', 'NOTDEFINED', 'Not defined.'), + ('PUBLIC', 'PUBLIC', 'Document is publicly available.'), + ('RESTRICTED', 'RESTRICTED', 'Document availability is restricted.'), + ('CONFIDENTIAL', 'CONFIDENTIAL', 'Document is confidential and its contents should not be revealed without permission.'), + ('PERSONAL', 'PERSONAL', 'Document is personal to the author.'), + ('USERDEFINED', 'USERDEFINED', 'Describe confidentiality elsewhere.') + ], name='Confidentiality') + status: EnumProperty(items=[ + ('NOTDEFINED', 'NOTDEFINED', 'Not defined'), + ('DRAFT', 'DRAFT', 'Document is a draft.'), + ('FINALDRAFT', 'FINALDRAFT', 'Document is a final draft.'), + ('FINAL', 'FINAL', 'Document is final.'), + ('REVISION', 'REVISION', 'Document has undergone revision.'), + ], name='Status') + + class BcfTopic(PropertyGroup): name: StringProperty(name='Name') @@ -857,6 +890,8 @@ class BIMProperties(PropertyGroup): section_plane_colour: FloatVectorProperty(name='Section Plane Colour', subtype='COLOR', default=(1, 0, 0), min=0.0, max=1.0) ifc_selector: StringProperty(default='', name='IFC Selector') csv_attributes: CollectionProperty(name='CSV Attributes', type=StrProperty) + document_information: CollectionProperty(name='Document Information', type=DocumentInformation) + active_document_information_index: IntProperty(name='Active Document Information Index') class BCFProperties(PropertyGroup): diff --git a/src/ifcblenderexport/blenderbim/bim/ui.py b/src/ifcblenderexport/blenderbim/bim/ui.py index 734fc4b3e5..932ba13556 100644 --- a/src/ifcblenderexport/blenderbim/bim/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/ui.py @@ -101,6 +101,62 @@ class BIM_PT_object(Panel): row.prop(props, 'structural_member_connection') +class BIM_PT_document_information(Panel): + bl_label = 'Document Information' + bl_idname = 'BIM_PT_document_information' + bl_options = {'DEFAULT_CLOSED'} + bl_space_type = 'PROPERTIES' + bl_region_type = 'WINDOW' + bl_context = 'scene' + + def draw(self, context): + layout = self.layout + layout.use_property_split = True + props = context.scene.BIMProperties + + row = layout.row() + row.operator('bim.add_document_information') + + if not props.document_information: + layout.label(text="No document information found") + else: + layout.template_list('BIM_UL_document_information', '', props, 'document_information', props, 'active_document_information_index') + + if props.active_document_information_index < len(props.document_information): + information = props.document_information[props.active_document_information_index] + row = layout.row(align=True) + row.prop(information, 'name') + row.operator('bim.remove_document_information', icon='X', text='').index = props.active_document_information_index + row = layout.row() + row.prop(information, 'human_name') + row = layout.row() + row.prop(information, 'description') + row = layout.row() + row.prop(information, 'location') + row = layout.row() + row.prop(information, 'purpose') + row = layout.row() + row.prop(information, 'intended_use') + row = layout.row() + row.prop(information, 'scope') + row = layout.row() + row.prop(information, 'revision') + row = layout.row() + row.prop(information, 'creation_time') + row = layout.row() + row.prop(information, 'last_revision_time') + row = layout.row() + row.prop(information, 'electronic_format') + row = layout.row() + row.prop(information, 'valid_from') + row = layout.row() + row.prop(information, 'valid_until') + row = layout.row() + row.prop(information, 'confidentiality') + row = layout.row() + row.prop(information, 'status') + + class BIM_PT_documents(Panel): bl_label = 'Documents' bl_idname = 'BIM_PT_documents' @@ -1016,6 +1072,15 @@ class BIM_UL_topics(bpy.types.UIList): layout.label(text="", translate=False) +class BIM_UL_document_information(bpy.types.UIList): + def draw_item(self, context, layout, data, item, icon, active_data, active_propname): + ob = data + if item: + layout.prop(item, 'name', text='', emboss=False) + else: + layout.label(text="", translate=False) + + class BIM_UL_classifications(bpy.types.UIList): def draw_item(self, context, layout, data, item, icon, active_data, active_propname): if self.layout_type in {'DEFAULT', 'COMPACT'}: