Fix #1642. New feature to select the type's Blender object of the active object.

This commit is contained in:
Dion Moult
2021-08-14 19:12:09 +10:00
parent ac9e6cc661
commit b29ace296a
3 changed files with 20 additions and 0 deletions
@@ -8,6 +8,7 @@ classes = (
operator.DisableEditingType,
operator.SelectSimilarType,
operator.SelectTypeObjects,
operator.SelectType,
prop.BIMTypeProperties,
prop.BIMTypeObjectProperties,
ui.BIM_PT_type,
@@ -109,6 +109,24 @@ class DisableEditingType(bpy.types.Operator):
return {"FINISHED"}
class SelectType(bpy.types.Operator):
bl_idname = "bim.select_type"
bl_label = "Select Type"
bl_options = {"REGISTER", "UNDO"}
related_object: bpy.props.StringProperty()
def execute(self, context):
self.file = IfcStore.get_file()
related_object = bpy.data.objects.get(self.related_object) if self.related_object else context.active_object
oprops = related_object.BIMObjectProperties
obj = IfcStore.get_element(
ifcopenshell.util.element.get_type(self.file.by_id(oprops.ifc_definition_id)).GlobalId
)
context.view_layer.objects.active = obj
obj.select_set(True)
return {"FINISHED"}
class SelectSimilarType(bpy.types.Operator):
bl_idname = "bim.select_similar_type"
bl_label = "Select Similar Type"
@@ -64,6 +64,7 @@ class BIM_PT_type(Panel):
else:
label = name
row.label(text=label)
row.operator("bim.select_type", icon="TRACKER", text="")
row.operator("bim.select_similar_type", icon="RESTRICT_SELECT_OFF", text="")
row.operator("bim.enable_editing_type", icon="GREASEPENCIL", text="")
if name != "None/None":