Adding a new type instance (like furniture, walls) now snaps it to the bottom of the storey you're working on. Nice.

This commit is contained in:
Dion Moult
2021-05-19 17:59:13 +10:00
parent 77a97233c5
commit 82692bb88d
2 changed files with 8 additions and 6 deletions
@@ -109,7 +109,7 @@ class BIM_PT_object_material(Panel):
if self.props.is_editing:
op = row.operator("bim.edit_assigned_material", icon="CHECKMARK", text="")
op.material_set = self.material_set_id
row.operator("bim.disable_editing_assigned_material", icon="X", text="")
row.operator("bim.disable_editing_assigned_material", icon="CANCEL", text="")
else:
row.operator("bim.enable_editing_assigned_material", icon="GREASEPENCIL", text="")
row.operator("bim.unassign_material", icon="X", text="")
@@ -168,7 +168,7 @@ class BIM_PT_object_material(Panel):
row.prop(self.props, "material_set_item_material", icon="MATERIAL")
op = row.operator("bim.edit_material_set_item", icon="CHECKMARK", text="")
op.material_set_item = set_item_id
row.operator("bim.disable_editing_material_set_item", icon="X", text="")
row.operator("bim.disable_editing_material_set_item", icon="CANCEL", text="")
for attribute in self.props.material_set_item_attributes:
row = box.row(align=True)
@@ -197,7 +197,7 @@ class BIM_PT_object_material(Panel):
else:
# TODO: support non parametric profiles by showing a list of named profiles to select from, or an
# eyedropper to pick profile geometry from the scene
row.operator("bim.disable_editing_material_set_item", icon="X", text="")
row.operator("bim.disable_editing_material_set_item", icon="CANCEL", text="")
def draw_editable_profile_ui(self, layout, item):
for attribute in self.props.material_set_item_profile_attributes:
@@ -37,9 +37,11 @@ class AddTypeInstance(bpy.types.Operator):
mesh.from_pydata(verts, edges, faces)
obj = bpy.data.objects.new("Instance", mesh)
obj.location = context.scene.cursor.location
context.view_layer.active_layer_collection.collection.objects.link(obj)
self.file = IfcStore.get_file()
instance_class = ifcopenshell.util.type.get_applicable_entities(tprops.ifc_class, self.file.schema)[0]
collection = bpy.context.view_layer.active_layer_collection.collection
collection.objects.link(obj)
collection_obj = bpy.data.objects.get(collection.name)
if collection_obj:
obj.location[2] = collection_obj.location[2] - min(v[2] for v in obj.bound_box)
bpy.ops.bim.assign_class(obj=obj.name, ifc_class=instance_class)
bpy.ops.bim.assign_type(relating_type=int(tprops.relating_type), related_object=obj.name)
return {"FINISHED"}