mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Thanks @ihabelaghoury! You can now select objects in the viewport by GlobalId from the IFC inspector
This commit is contained in:
@@ -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"}
|
||||
|
||||
Reference in New Issue
Block a user