mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
The filter search field now also filters description and predefined type
This commit is contained in:
@@ -138,9 +138,18 @@ class AuthoringData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def type_elements_filtered(cls):
|
def type_elements_filtered(cls):
|
||||||
|
search_query = cls.props.search_name.lower()
|
||||||
|
def filter_element(element):
|
||||||
|
if search_query in (element.Name or "Unnamed").lower():
|
||||||
|
return True
|
||||||
|
if search_query in (element.Description or "").lower():
|
||||||
|
return True
|
||||||
|
if search_query in ifcopenshell.util.element.get_predefined_type(element).lower():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
elements = cls.data["type_elements"]
|
elements = cls.data["type_elements"]
|
||||||
if cls.props.search_name:
|
if cls.props.search_name:
|
||||||
return [e for e in elements if cls.props.search_name.lower() in (e.Name or "Unnamed").lower()]
|
return [e for e in elements if filter_element(e)]
|
||||||
return elements
|
return elements
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ class LaunchTypeManager(bpy.types.Operator):
|
|||||||
row.operator("bim.launch_add_element", text=f"Create New {AuthoringData.data['ifc_element_type']}", icon="ADD")
|
row.operator("bim.launch_add_element", text=f"Create New {AuthoringData.data['ifc_element_type']}", icon="ADD")
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
|
# row.prop(props, "relating_type_id", text="")
|
||||||
row.prop(props, "search_name", icon="FILTER", text="")
|
row.prop(props, "search_name", icon="FILTER", text="")
|
||||||
|
|
||||||
columns = self.layout.column_flow(columns=3)
|
columns = self.layout.column_flow(columns=3)
|
||||||
|
|||||||
Reference in New Issue
Block a user