mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 10:18:35 +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.RemoveMaterialPset,
|
||||||
operator.AddDocumentInformation,
|
operator.AddDocumentInformation,
|
||||||
operator.RemoveDocumentInformation,
|
operator.RemoveDocumentInformation,
|
||||||
|
operator.AssignDocumentInformation,
|
||||||
operator.AddDocumentReference,
|
operator.AddDocumentReference,
|
||||||
operator.RemoveDocumentReference,
|
operator.RemoveDocumentReference,
|
||||||
operator.AssignDocumentReference,
|
operator.AssignDocumentReference,
|
||||||
|
|||||||
@@ -689,6 +689,7 @@ class IfcParser():
|
|||||||
results[reference.name] = {
|
results[reference.name] = {
|
||||||
'ifc': None,
|
'ifc': None,
|
||||||
'raw': reference,
|
'raw': reference,
|
||||||
|
'referenced_document': reference.referenced_document,
|
||||||
'attributes': attributes
|
'attributes': attributes
|
||||||
}
|
}
|
||||||
return results
|
return results
|
||||||
@@ -1347,6 +1348,9 @@ class IfcExporter():
|
|||||||
|
|
||||||
def create_document_references(self):
|
def create_document_references(self):
|
||||||
for reference in self.ifc_parser.document_references.values():
|
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(
|
reference['ifc'] = self.file.create_entity(
|
||||||
'IfcDocumentReference', **reference['attributes'])
|
'IfcDocumentReference', **reference['attributes'])
|
||||||
self.file.createIfcRelAssociatesDocument(
|
self.file.createIfcRelAssociatesDocument(
|
||||||
|
|||||||
@@ -812,6 +812,20 @@ class RemoveDocumentInformation(bpy.types.Operator):
|
|||||||
return {'FINISHED'}
|
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):
|
class AddDocumentReference(bpy.types.Operator):
|
||||||
bl_idname = 'bim.add_document_reference'
|
bl_idname = 'bim.add_document_reference'
|
||||||
bl_label = 'Add Document Reference'
|
bl_label = 'Add Document Reference'
|
||||||
|
|||||||
@@ -427,6 +427,7 @@ class DocumentReference(PropertyGroup):
|
|||||||
name: StringProperty(name="Identification")
|
name: StringProperty(name="Identification")
|
||||||
human_name: StringProperty(name="Name")
|
human_name: StringProperty(name="Name")
|
||||||
description: StringProperty(name="Description")
|
description: StringProperty(name="Description")
|
||||||
|
referenced_document: StringProperty(name="Referenced Document")
|
||||||
|
|
||||||
|
|
||||||
class BcfTopic(PropertyGroup):
|
class BcfTopic(PropertyGroup):
|
||||||
|
|||||||
@@ -171,6 +171,9 @@ class BIM_PT_document_information(Panel):
|
|||||||
row.prop(reference, 'location')
|
row.prop(reference, 'location')
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(reference, 'description')
|
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 = layout.row(align=True)
|
||||||
row.operator('bim.assign_document_reference', text='Assign Reference')
|
row.operator('bim.assign_document_reference', text='Assign Reference')
|
||||||
@@ -212,6 +215,8 @@ class BIM_PT_documents(Panel):
|
|||||||
row.prop(reference, 'location')
|
row.prop(reference, 'location')
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(reference, 'description')
|
row.prop(reference, 'description')
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(reference, 'referenced_document')
|
||||||
else:
|
else:
|
||||||
layout.label(text="Reference is invalid")
|
layout.label(text="Reference is invalid")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user