Fix bug where new instances may have a wrong Z coordinate

This commit is contained in:
Dion Moult
2022-09-05 11:05:28 +10:00
parent 68ef6458d7
commit 917344ee1d
11 changed files with 178 additions and 1 deletions
@@ -100,6 +100,7 @@ class AddConstrTypeInstance(bpy.types.Operator):
building_obj = None
if len(context.selected_objects) == 1 and context.active_object:
building_obj = context.active_object
building_element = tool.Ifc.get_entity(building_obj)
# A cube
verts = [
@@ -131,8 +132,14 @@ class AddConstrTypeInstance(bpy.types.Operator):
bpy.ops.bim.assign_class(obj=obj.name, ifc_class=instance_class)
element = tool.Ifc.get_entity(obj)
blenderbim.core.type.assign_type(tool.Ifc, tool.Type, element=element, type=relating_type)
# Update required as core.type.assign_type may change obj.data
bpy.context.view_layer.update()
if building_obj:
if (
building_obj
and building_element
and building_element.is_a() in ["IfcWall", "IfcWallStandardCase", "IfcCovering"]
):
if instance_class in ["IfcWindow", "IfcDoor"]:
# TODO For now we are hardcoding windows and doors as a prototype
bpy.ops.bim.add_element_opening(