mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
Author and export document information metadata
This commit is contained in:
@@ -53,6 +53,8 @@ if bpy is not None:
|
|||||||
operator.RemoveQto,
|
operator.RemoveQto,
|
||||||
operator.AddMaterialPset,
|
operator.AddMaterialPset,
|
||||||
operator.RemoveMaterialPset,
|
operator.RemoveMaterialPset,
|
||||||
|
operator.AddDocumentInformation,
|
||||||
|
operator.RemoveDocumentInformation,
|
||||||
operator.AddDocument,
|
operator.AddDocument,
|
||||||
operator.RemoveDocument,
|
operator.RemoveDocument,
|
||||||
operator.GenerateGlobalId,
|
operator.GenerateGlobalId,
|
||||||
@@ -116,6 +118,7 @@ if bpy is not None:
|
|||||||
prop.ClassificationView,
|
prop.ClassificationView,
|
||||||
prop.PropertySetTemplate,
|
prop.PropertySetTemplate,
|
||||||
prop.PropertyTemplate,
|
prop.PropertyTemplate,
|
||||||
|
prop.DocumentInformation,
|
||||||
prop.BcfTopic,
|
prop.BcfTopic,
|
||||||
prop.BcfTopicLabel,
|
prop.BcfTopicLabel,
|
||||||
prop.BcfTopicFile,
|
prop.BcfTopicFile,
|
||||||
@@ -144,6 +147,7 @@ if bpy is not None:
|
|||||||
ui.BIM_PT_bim,
|
ui.BIM_PT_bim,
|
||||||
ui.BIM_PT_psets,
|
ui.BIM_PT_psets,
|
||||||
ui.BIM_PT_classifications,
|
ui.BIM_PT_classifications,
|
||||||
|
ui.BIM_PT_document_information,
|
||||||
ui.BIM_PT_search,
|
ui.BIM_PT_search,
|
||||||
ui.BIM_PT_ifccsv,
|
ui.BIM_PT_ifccsv,
|
||||||
ui.BIM_PT_bcf,
|
ui.BIM_PT_bcf,
|
||||||
@@ -160,6 +164,7 @@ if bpy is not None:
|
|||||||
ui.BIM_PT_classification_references,
|
ui.BIM_PT_classification_references,
|
||||||
ui.BIM_PT_documents,
|
ui.BIM_PT_documents,
|
||||||
ui.BIM_PT_camera,
|
ui.BIM_PT_camera,
|
||||||
|
ui.BIM_UL_document_information,
|
||||||
ui.BIM_UL_topics,
|
ui.BIM_UL_topics,
|
||||||
ui.BIM_UL_classifications,
|
ui.BIM_UL_classifications,
|
||||||
ui.BIM_ADDON_preferences,
|
ui.BIM_ADDON_preferences,
|
||||||
|
|||||||
@@ -137,6 +137,7 @@ class IfcParser():
|
|||||||
unique_objects = self.add_spatial_elements_if_unselected(selected_objects)
|
unique_objects = self.add_spatial_elements_if_unselected(selected_objects)
|
||||||
self.categorise_selected_objects(unique_objects)
|
self.categorise_selected_objects(unique_objects)
|
||||||
self.material_psets = self.get_material_psets()
|
self.material_psets = self.get_material_psets()
|
||||||
|
self.document_information = self.get_document_information()
|
||||||
self.documents = self.get_documents()
|
self.documents = self.get_documents()
|
||||||
self.classifications = self.get_classifications()
|
self.classifications = self.get_classifications()
|
||||||
self.classification_references = self.get_classification_references()
|
self.classification_references = self.get_classification_references()
|
||||||
@@ -686,6 +687,37 @@ class IfcParser():
|
|||||||
}}
|
}}
|
||||||
return documents
|
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):
|
def get_project(self):
|
||||||
for collection in bpy.data.collections:
|
for collection in bpy.data.collections:
|
||||||
if self.is_a_project(self.get_ifc_class(collection.name)):
|
if self.is_a_project(self.get_ifc_class(collection.name)):
|
||||||
@@ -1107,6 +1139,7 @@ class IfcExporter():
|
|||||||
self.create_rep_context()
|
self.create_rep_context()
|
||||||
self.create_project()
|
self.create_project()
|
||||||
self.create_library_information()
|
self.create_library_information()
|
||||||
|
self.create_document_information()
|
||||||
self.create_documents()
|
self.create_documents()
|
||||||
self.create_classifications()
|
self.create_classifications()
|
||||||
self.create_classification_references()
|
self.create_classification_references()
|
||||||
@@ -1301,6 +1334,11 @@ class IfcExporter():
|
|||||||
[self.ifc_parser.project['ifc']],
|
[self.ifc_parser.project['ifc']],
|
||||||
information['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):
|
def create_documents(self):
|
||||||
for document in self.ifc_parser.documents.values():
|
for document in self.ifc_parser.documents.values():
|
||||||
document['ifc'] = self.file.create_entity(
|
document['ifc'] = self.file.create_entity(
|
||||||
|
|||||||
@@ -461,7 +461,6 @@ class IfcImporter():
|
|||||||
if element.is_a('IfcReinforcingBar'):
|
if element.is_a('IfcReinforcingBar'):
|
||||||
mesh = self.create_mesh(element, shape, is_curve=True)
|
mesh = self.create_mesh(element, shape, is_curve=True)
|
||||||
mesh.bevel_depth = self.native_elements[element.GlobalId]['radius']
|
mesh.bevel_depth = self.native_elements[element.GlobalId]['radius']
|
||||||
mesh.use_fill_caps = True
|
|
||||||
else:
|
else:
|
||||||
mesh = self.create_mesh(element, shape)
|
mesh = self.create_mesh(element, shape)
|
||||||
self.meshes[mesh_name] = mesh
|
self.meshes[mesh_name] = mesh
|
||||||
|
|||||||
@@ -2236,3 +2236,22 @@ class SelectSimilarType(bpy.types.Operator):
|
|||||||
if obj.BIMObjectProperties.relating_type == relating_type:
|
if obj.BIMObjectProperties.relating_type == relating_type:
|
||||||
obj.select_set(True)
|
obj.select_set(True)
|
||||||
return {'FINISHED'}
|
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'}
|
||||||
|
|||||||
@@ -400,6 +400,39 @@ class BIMCameraProperties(PropertyGroup):
|
|||||||
is_nts: BoolProperty(name='Is NTS')
|
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):
|
class BcfTopic(PropertyGroup):
|
||||||
name: StringProperty(name='Name')
|
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)
|
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')
|
ifc_selector: StringProperty(default='', name='IFC Selector')
|
||||||
csv_attributes: CollectionProperty(name='CSV Attributes', type=StrProperty)
|
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):
|
class BCFProperties(PropertyGroup):
|
||||||
|
|||||||
@@ -101,6 +101,62 @@ class BIM_PT_object(Panel):
|
|||||||
row.prop(props, 'structural_member_connection')
|
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):
|
class BIM_PT_documents(Panel):
|
||||||
bl_label = 'Documents'
|
bl_label = 'Documents'
|
||||||
bl_idname = 'BIM_PT_documents'
|
bl_idname = 'BIM_PT_documents'
|
||||||
@@ -1016,6 +1072,15 @@ class BIM_UL_topics(bpy.types.UIList):
|
|||||||
layout.label(text="", translate=False)
|
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):
|
class BIM_UL_classifications(bpy.types.UIList):
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||||
|
|||||||
Reference in New Issue
Block a user