mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 14:41:25 +00:00
bim.select_entity - move to bim module
as it can be generally useful, not just in tester
This commit is contained in:
@@ -99,6 +99,7 @@ classes = [
|
|||||||
operator.BIM_OT_add_section_plane,
|
operator.BIM_OT_add_section_plane,
|
||||||
operator.BIM_OT_delete_object,
|
operator.BIM_OT_delete_object,
|
||||||
operator.BIM_OT_remove_section_plane,
|
operator.BIM_OT_remove_section_plane,
|
||||||
|
operator.BIM_OT_select_entity,
|
||||||
operator.BIM_OT_select_object,
|
operator.BIM_OT_select_object,
|
||||||
operator.BIM_OT_show_description,
|
operator.BIM_OT_show_description,
|
||||||
operator.BIM_OT_multiple_file_selector,
|
operator.BIM_OT_multiple_file_selector,
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ classes = (
|
|||||||
operator.ExecuteIfcTester,
|
operator.ExecuteIfcTester,
|
||||||
operator.SelectRequirement,
|
operator.SelectRequirement,
|
||||||
operator.SelectFailedEntities,
|
operator.SelectFailedEntities,
|
||||||
operator.SelectEntity,
|
|
||||||
operator.ExportBcf,
|
operator.ExportBcf,
|
||||||
prop.FailedEntities,
|
prop.FailedEntities,
|
||||||
prop.Specification,
|
prop.Specification,
|
||||||
|
|||||||
@@ -184,21 +184,6 @@ class SelectFailedEntities(bpy.types.Operator):
|
|||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class SelectEntity(bpy.types.Operator):
|
|
||||||
bl_idname = "bim.select_entity"
|
|
||||||
bl_label = "Select Entity"
|
|
||||||
bl_options = {"REGISTER", "UNDO"}
|
|
||||||
ifc_id: bpy.props.IntProperty()
|
|
||||||
|
|
||||||
def execute(self, context):
|
|
||||||
bpy.ops.object.select_all(action="DESELECT")
|
|
||||||
for obj in context.scene.objects:
|
|
||||||
if obj.BIMObjectProperties.ifc_definition_id == self.ifc_id:
|
|
||||||
obj.select_set(True)
|
|
||||||
bpy.context.view_layer.objects.active = obj
|
|
||||||
return {"FINISHED"}
|
|
||||||
|
|
||||||
|
|
||||||
class ExportBcf(bpy.types.Operator):
|
class ExportBcf(bpy.types.Operator):
|
||||||
bl_idname = "bim.export_bcf"
|
bl_idname = "bim.export_bcf"
|
||||||
bl_label = "Export BCF"
|
bl_label = "Export BCF"
|
||||||
|
|||||||
@@ -955,6 +955,32 @@ class BIM_OT_enum_property_search(bpy.types.Operator):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class BIM_OT_select_entity(bpy.types.Operator):
|
||||||
|
bl_idname = "bim.select_entity"
|
||||||
|
bl_label = "Select Entity"
|
||||||
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
ifc_id: bpy.props.IntProperty()
|
||||||
|
tooltip: bpy.props.StringProperty()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def description(cls, context, properties) -> str:
|
||||||
|
return properties.tooltip
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
element = tool.Ifc.get_entity_by_id(self.ifc_id)
|
||||||
|
if not element:
|
||||||
|
self.report({"ERROR"}, f"No IFC element found with id #{self.ifc_id}.")
|
||||||
|
return {"CANCELLED"}
|
||||||
|
|
||||||
|
obj = tool.Ifc.get_object(element)
|
||||||
|
if not isinstance(obj, bpy.types.Object):
|
||||||
|
self.report({"ERROR"}, f"The following element is not present in the scene as Blender object: '{element}'.")
|
||||||
|
return {"CANCELLED"}
|
||||||
|
|
||||||
|
tool.Blender.set_objects_selection(context, obj, [obj], clear_previous_selection=True)
|
||||||
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
class BIM_OT_select_object(bpy.types.Operator):
|
class BIM_OT_select_object(bpy.types.Operator):
|
||||||
bl_idname = "bim.select_object"
|
bl_idname = "bim.select_object"
|
||||||
bl_label = "Select Object"
|
bl_label = "Select Object"
|
||||||
|
|||||||
Reference in New Issue
Block a user