WIP port constraints module. See #1222.

This commit is contained in:
Dion Moult
2021-01-23 16:32:52 +11:00
parent d0b2bf85cc
commit 9b6366ddac
16 changed files with 526 additions and 286 deletions
@@ -349,8 +349,6 @@ class IfcImporter:
self.profile_code("Set units")
self.create_project()
self.profile_code("Create project")
self.create_constraints()
self.profile_code("Create constraints")
self.create_spatial_hierarchy()
self.profile_code("Create spatial hierarchy")
self.create_type_products()
@@ -1245,22 +1243,6 @@ class IfcImporter:
self.project["blender"].objects.link(obj)
del self.added_data[self.project["ifc"].GlobalId]
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_spatial_hierarchy(self):
if self.project["ifc"].IsDecomposedBy:
for rel_aggregate in self.project["ifc"].IsDecomposedBy: