mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
New feature to select all of the active IFC element's class
This commit is contained in:
@@ -40,6 +40,7 @@ class BIM_PT_class(Panel):
|
||||
name += "[{}]".format(data["PredefinedType"])
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text=name)
|
||||
row.operator("bim.select_ifc_class", text="", icon="RESTRICT_SELECT_OFF").ifc_class = data["type"]
|
||||
row.operator("bim.copy_class", icon="DUPLICATE", text="")
|
||||
row.operator("bim.unlink_object", icon="UNLINKED", text="")
|
||||
if IfcStore.get_file().by_id(props.ifc_definition_id).is_a("IfcRoot"):
|
||||
|
||||
@@ -62,15 +62,15 @@ class SelectIfcClass(bpy.types.Operator):
|
||||
bl_idname = "bim.select_ifc_class"
|
||||
bl_label = "Select IFC Class"
|
||||
bl_options = {"REGISTER", "UNDO"}
|
||||
ifc_class: bpy.props.StringProperty()
|
||||
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
props = context.scene.BIMSearchProperties
|
||||
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 does_keyword_exist(props.ifc_class, element.is_a()):
|
||||
if does_keyword_exist(self.ifc_class, element.is_a()):
|
||||
obj.select_set(True)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class BIM_PT_search(Panel):
|
||||
|
||||
row = self.layout.row(align=True)
|
||||
row.prop(props, "ifc_class", text="", icon="OBJECT_DATA")
|
||||
row.operator("bim.select_ifc_class", text="", icon="VIEWZOOM")
|
||||
row.operator("bim.select_ifc_class", text="", icon="VIEWZOOM").ifc_class = props.ifc_class
|
||||
row.operator("bim.colour_by_class", text="", icon="BRUSH_DATA")
|
||||
|
||||
row = self.layout.row(align=True)
|
||||
|
||||
@@ -6,6 +6,8 @@ class Usecase:
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
address = self.file.create_entity(self.settings["ifc_class"], "OFFICE")
|
||||
addresses = list(self.settings["assigned_object"].Addresses) if self.settings["assigned_object"].Addresses else []
|
||||
addresses.append(self.file.create_entity(self.settings["ifc_class"], "OFFICE"))
|
||||
addresses.append(address)
|
||||
self.settings["assigned_object"].Addresses = addresses
|
||||
return address
|
||||
|
||||
@@ -6,6 +6,8 @@ class Usecase:
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
element = self.file.createIfcActorRole("ARCHITECT")
|
||||
roles = list(self.settings["assigned_object"].Roles) if self.settings["assigned_object"].Roles else []
|
||||
roles.append(self.file.createIfcActorRole("ARCHITECT"))
|
||||
roles.append(element)
|
||||
self.settings["assigned_object"].Roles = roles
|
||||
return element
|
||||
|
||||
Reference in New Issue
Block a user