Thanks @ihabelaghoury! You can now select objects in the viewport by GlobalId from the IFC inspector

This commit is contained in:
Dion Moult
2021-03-25 20:29:37 +11:00
parent 0bc86631a5
commit d4736710a5
2 changed files with 6 additions and 1 deletions
@@ -53,6 +53,9 @@ class BIM_PT_debug(Panel):
row = layout.row(align=True)
row.prop(attribute, "name", text="")
row.prop(attribute, "string_value", text="")
if attribute.name == "GlobalId":
op = row.operator("bim.select_global_id", icon="RESTRICT_SELECT_OFF", text="")
op.global_id = attribute.string_value
if attribute.int_value:
row.operator(
"bim.inspect_from_step_id", icon="DISCLOSURE_TRI_RIGHT", text=""
@@ -41,15 +41,17 @@ def does_keyword_exist(pattern, string):
class SelectGlobalId(bpy.types.Operator):
bl_idname = "bim.select_global_id"
bl_label = "Select GlobalId"
global_id: bpy.props.StringProperty()
def execute(self, context):
self.file = IfcStore.get_file()
props = context.scene.BIMSearchProperties
global_id = self.global_id or props.global_id
for obj in context.visible_objects:
if not obj.BIMObjectProperties.ifc_definition_id:
continue
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
if element.GlobalId == props.global_id:
if element.GlobalId == global_id:
obj.select_set(True)
break
return {"FINISHED"}