mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
You can now relate and export document references and information entities
This commit is contained in:
@@ -55,6 +55,7 @@ if bpy is not None:
|
||||
operator.RemoveMaterialPset,
|
||||
operator.AddDocumentInformation,
|
||||
operator.RemoveDocumentInformation,
|
||||
operator.AssignDocumentInformation,
|
||||
operator.AddDocumentReference,
|
||||
operator.RemoveDocumentReference,
|
||||
operator.AssignDocumentReference,
|
||||
|
||||
@@ -689,6 +689,7 @@ class IfcParser():
|
||||
results[reference.name] = {
|
||||
'ifc': None,
|
||||
'raw': reference,
|
||||
'referenced_document': reference.referenced_document,
|
||||
'attributes': attributes
|
||||
}
|
||||
return results
|
||||
@@ -1347,6 +1348,9 @@ class IfcExporter():
|
||||
|
||||
def create_document_references(self):
|
||||
for reference in self.ifc_parser.document_references.values():
|
||||
if reference['referenced_document'] \
|
||||
and reference['referenced_document'] in self.ifc_parser.document_information:
|
||||
reference['attributes']['ReferencedDocument'] = self.ifc_parser.document_information[reference['referenced_document']]['ifc']
|
||||
reference['ifc'] = self.file.create_entity(
|
||||
'IfcDocumentReference', **reference['attributes'])
|
||||
self.file.createIfcRelAssociatesDocument(
|
||||
|
||||
@@ -812,6 +812,20 @@ class RemoveDocumentInformation(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class AssignDocumentInformation(bpy.types.Operator):
|
||||
bl_idname = 'bim.assign_document_information'
|
||||
bl_label = 'Assign Document Information'
|
||||
index: bpy.props.IntProperty()
|
||||
|
||||
def execute(self, context):
|
||||
reference = bpy.context.scene.BIMProperties.document_references[self.index]
|
||||
index = bpy.context.scene.BIMProperties.active_document_information_index
|
||||
info = bpy.context.scene.BIMProperties.document_information
|
||||
if index < len(info):
|
||||
reference.referenced_document = info[index].name
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class AddDocumentReference(bpy.types.Operator):
|
||||
bl_idname = 'bim.add_document_reference'
|
||||
bl_label = 'Add Document Reference'
|
||||
|
||||
@@ -427,6 +427,7 @@ class DocumentReference(PropertyGroup):
|
||||
name: StringProperty(name="Identification")
|
||||
human_name: StringProperty(name="Name")
|
||||
description: StringProperty(name="Description")
|
||||
referenced_document: StringProperty(name="Referenced Document")
|
||||
|
||||
|
||||
class BcfTopic(PropertyGroup):
|
||||
|
||||
@@ -171,6 +171,9 @@ class BIM_PT_document_information(Panel):
|
||||
row.prop(reference, 'location')
|
||||
row = layout.row()
|
||||
row.prop(reference, 'description')
|
||||
row = layout.row(align=True)
|
||||
row.prop(reference, 'referenced_document')
|
||||
row.operator('bim.assign_document_information', icon='LINKED', text='').index = props.active_document_reference_index
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.operator('bim.assign_document_reference', text='Assign Reference')
|
||||
@@ -212,6 +215,8 @@ class BIM_PT_documents(Panel):
|
||||
row.prop(reference, 'location')
|
||||
row = layout.row()
|
||||
row.prop(reference, 'description')
|
||||
row = layout.row()
|
||||
row.prop(reference, 'referenced_document')
|
||||
else:
|
||||
layout.label(text="Reference is invalid")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user