From 82692bb88de543dc1cb7d958a7cfb1fa09f7ff64 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 19 May 2021 17:59:13 +1000 Subject: [PATCH] Adding a new type instance (like furniture, walls) now snaps it to the bottom of the storey you're working on. Nice. --- src/blenderbim/blenderbim/bim/module/material/ui.py | 6 +++--- src/blenderbim/blenderbim/bim/module/model/operator.py | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/material/ui.py b/src/blenderbim/blenderbim/bim/module/material/ui.py index 262a920ef3..3d446a98a7 100644 --- a/src/blenderbim/blenderbim/bim/module/material/ui.py +++ b/src/blenderbim/blenderbim/bim/module/material/ui.py @@ -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: diff --git a/src/blenderbim/blenderbim/bim/module/model/operator.py b/src/blenderbim/blenderbim/bim/module/model/operator.py index 6741d48e45..096e213df6 100644 --- a/src/blenderbim/blenderbim/bim/module/model/operator.py +++ b/src/blenderbim/blenderbim/bim/module/model/operator.py @@ -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"}