mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
Support import of document information and relationships
This commit is contained in:
@@ -224,6 +224,7 @@ class IfcImporter():
|
|||||||
self.calculate_unit_scale()
|
self.calculate_unit_scale()
|
||||||
self.create_project()
|
self.create_project()
|
||||||
self.create_classifications()
|
self.create_classifications()
|
||||||
|
self.create_document_information()
|
||||||
self.create_document_references()
|
self.create_document_references()
|
||||||
self.create_spatial_hierarchy()
|
self.create_spatial_hierarchy()
|
||||||
self.purge_diff()
|
self.purge_diff()
|
||||||
@@ -750,18 +751,45 @@ class IfcImporter():
|
|||||||
results.extend(self.file.get_inverse(reference))
|
results.extend(self.file.get_inverse(reference))
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def create_document_references(self):
|
def create_document_information(self):
|
||||||
for data in self.file.by_type('IfcDocumentReference'):
|
for element in self.file.by_type('IfcDocumentInformation'):
|
||||||
reference = bpy.context.scene.BIMProperties.document_references.add()
|
info = bpy.context.scene.BIMProperties.document_information.add()
|
||||||
data_map = {
|
data_map = {
|
||||||
'location': 'Location',
|
|
||||||
'name': 'Identification',
|
'name': 'Identification',
|
||||||
'human_name': 'Name',
|
'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'
|
||||||
|
}
|
||||||
|
for key, value in data_map.items():
|
||||||
|
if hasattr(element, value) and getattr(element, value):
|
||||||
|
setattr(info, key, getattr(element, value))
|
||||||
|
|
||||||
|
|
||||||
|
def create_document_references(self):
|
||||||
|
for element in self.file.by_type('IfcDocumentReference'):
|
||||||
|
reference = bpy.context.scene.BIMProperties.document_references.add()
|
||||||
|
data_map = {
|
||||||
|
'name': 'Identification',
|
||||||
|
'human_name': 'Name',
|
||||||
|
'location': 'Location',
|
||||||
'description': 'Description'
|
'description': 'Description'
|
||||||
}
|
}
|
||||||
for key, value in data_map.items():
|
for key, value in data_map.items():
|
||||||
if hasattr(data, value) and getattr(data, value):
|
if hasattr(element, value) and getattr(element, value):
|
||||||
setattr(reference, key, getattr(data, value))
|
setattr(reference, key, getattr(element, value))
|
||||||
|
if element.ReferencedDocument:
|
||||||
|
reference.referenced_document = element.ReferencedDocument.Identification
|
||||||
|
|
||||||
def create_spatial_hierarchy(self):
|
def create_spatial_hierarchy(self):
|
||||||
if self.project['ifc'].IsDecomposedBy:
|
if self.project['ifc'].IsDecomposedBy:
|
||||||
|
|||||||
Reference in New Issue
Block a user