mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Support import of IfcObjective constraints
This commit is contained in:
@@ -305,6 +305,8 @@ class IfcImporter():
|
||||
self.profile_code('Create project')
|
||||
self.create_classifications()
|
||||
self.profile_code('Create classifications')
|
||||
self.create_constraints()
|
||||
self.profile_code('Create constraints')
|
||||
self.create_document_information()
|
||||
self.profile_code('Create doc info')
|
||||
self.create_document_references()
|
||||
@@ -1399,6 +1401,22 @@ class IfcImporter():
|
||||
results.extend(self.file.get_inverse(reference))
|
||||
return results
|
||||
|
||||
def create_constraints(self):
|
||||
for element in self.file.by_type('IfcObjective'):
|
||||
constraint = bpy.context.scene.BIMProperties.constraints.add()
|
||||
data_map = {
|
||||
'name': 'Name',
|
||||
'description': 'Description',
|
||||
'constraint_grade': 'ConstraintGrade',
|
||||
'constraint_source': 'ConstraintSource',
|
||||
'user_defined_grade': 'UserDefinedGrade',
|
||||
'objective_qualifier': 'ObjectiveQualifier',
|
||||
'user_defined_qualifier': 'UserDefinedQualifier',
|
||||
}
|
||||
for key, value in data_map.items():
|
||||
if hasattr(element, value) and getattr(element, value):
|
||||
setattr(constraint, key, getattr(element, value))
|
||||
|
||||
def create_document_information(self):
|
||||
for element in self.file.by_type('IfcDocumentInformation'):
|
||||
info = bpy.context.scene.BIMProperties.document_information.add()
|
||||
|
||||
Reference in New Issue
Block a user