Skip to content

Commit e2102cd

Browse files
committed
Fix #4306. Remove superseded selector UI.
1 parent d7317d2 commit e2102cd

5 files changed

Lines changed: 1 addition & 519 deletions

File tree

src/blenderbim/blenderbim/bim/module/diff/ui.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def draw(self, context):
9595

9696
row = layout.row(align=True)
9797
row.prop(props, "diff_filter_elements")
98-
row.operator("bim.ifc_selector", icon="FILTER", text="")
9998

10099
row = layout.row()
101100
row.operator("bim.execute_ifc_diff")

src/blenderbim/blenderbim/bim/module/search/__init__.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,15 @@
2424
operator.ActivateIfcClassFilter,
2525
operator.AddFilter,
2626
operator.AddFilterGroup,
27-
operator.AddToIfcGroup,
2827
operator.ColourByProperty,
2928
operator.EditFilterQuery,
30-
operator.FilterModelElements,
31-
operator.IfcSelector,
3229
operator.LoadColourscheme,
33-
operator.LoadQuery,
3430
operator.LoadSearch,
35-
operator.OpenQueryLibrary,
3631
operator.RemoveFilter,
3732
operator.RemoveFilterGroup,
3833
operator.ResetObjectColours,
3934
operator.SaveColourscheme,
4035
operator.SaveSearch,
41-
operator.SaveSelectorQuery,
4236
operator.Search,
4337
operator.SelectByProperty,
4438
operator.SelectFilterElements,
@@ -51,27 +45,19 @@
5145
prop.BIMFilterClasses,
5246
prop.BIMFilterBuildingStoreys,
5347
prop.BIMSearchProperties,
54-
prop.SearchCollection,
55-
prop.SearchQueryFilter,
56-
prop.SearchQuery,
57-
prop.SearchQueryGroup,
58-
prop.IfcSelectorProperties,
5948
ui.BIM_PT_search,
6049
ui.BIM_PT_filter,
6150
ui.BIM_PT_colour_by_property,
6251
ui.BIM_PT_select_similar,
6352
ui.BIM_UL_colourscheme,
6453
ui.BIM_UL_ifc_class_filter,
6554
ui.BIM_UL_ifc_building_storey_filter,
66-
ui.BIM_PT_IFCSelector,
6755
)
6856

6957

7058
def register():
7159
bpy.types.Scene.BIMSearchProperties = bpy.props.PointerProperty(type=prop.BIMSearchProperties)
72-
bpy.types.Scene.IfcSelectorProperties = bpy.props.PointerProperty(type=prop.IfcSelectorProperties)
7360

7461

7562
def unregister():
7663
del bpy.types.Scene.BIMSearchProperties
77-
del bpy.types.Scene.IfcSelectorProperties

src/blenderbim/blenderbim/bim/module/search/operator.py

Lines changed: 0 additions & 217 deletions
Original file line numberDiff line numberDiff line change
@@ -623,223 +623,6 @@ def execute(self, context):
623623
return {"FINISHED"}
624624

625625

626-
class FilterModelElements(Operator):
627-
"""Filter model elements based on selection"""
628-
629-
bl_idname = "bim.filter_model_elements"
630-
bl_label = "Filter Model Elements"
631-
option: StringProperty("select|isolate|hide")
632-
633-
def execute(self, context):
634-
selection_props = context.scene.IfcSelectorProperties
635-
selection = (
636-
selection_props.selector_query_syntax
637-
if selection_props.manual_override
638-
else self.add_groups(selection_props)
639-
)
640-
selection_props.selector_query_syntax = selection
641-
r = core.search(tool.Search, tool.Spatial, query=selection, action=self.option)
642-
if isinstance(r, str):
643-
self.report({"WARNING"}, r)
644-
return {"FINISHED"}
645-
646-
def add_groups(self, selector: str) -> str:
647-
selection = ""
648-
for group_index, group in enumerate(selector.groups):
649-
if group_index != 0:
650-
selection += " | "
651-
selection += "(" if len(selector.groups) > 1 else ""
652-
selection = self.add_queries(selection, group)
653-
654-
selection += ")" if len(selector.groups) > 1 else ""
655-
return selection
656-
657-
def add_queries(self, selection: str, group: str) -> str:
658-
for query_index, query in enumerate(group.queries):
659-
if query_index != 0:
660-
selection += " & " if query.and_or == "and" else " | "
661-
662-
if query.selector == "IFC Class":
663-
active_option = query.active_option.split(": ")[1]
664-
selection += f".{active_option}"
665-
selection = self.add_filters(selection, query)
666-
667-
elif query.selector == "GlobalId":
668-
selection += f"#{query.value}"
669-
670-
elif query.selector == "IfcElementType":
671-
index = int(query.active_sub_option.split(":")[0])
672-
selection += f"* #{query.sub_options[index].global_id}"
673-
674-
elif query.selector == "IfcSpatialElement":
675-
index = int(query.active_sub_option.split(":")[0])
676-
selection += f"@ #{query.sub_options[index].global_id}"
677-
return selection
678-
679-
def add_filters(self, selection: str, query: str) -> str:
680-
for f_index, f in enumerate(query.filters):
681-
if f_index != 0:
682-
selection += " & " if f.and_or == "and" else " | "
683-
selection += f".{query.active_option}"
684-
685-
if f.value in ("True", "False"):
686-
value = f.value
687-
elif f.value.isnumeric() and str(float(f.value))[0] == f.value[0]:
688-
value = f.value
689-
else:
690-
value = f'"{f.value}"'
691-
692-
selection += "["
693-
694-
if f.selector == "IfcPropertySet":
695-
selection += f'{f.active_option.split(": ")[1]}.{f.active_sub_option.split(": ")[1]} {"!" if f.negation else ""}{f.comparison} {value}'
696-
elif f.selector == "Attribute":
697-
# we're using the prop_search functionality in blender which returns the index of the option. Sometimes the user can override this and enter a value that doesn't exist in the list. In this case there is no index and we need to handle it. @vulevukusej
698-
pattern = re.compile(r"^[0-9]+:")
699-
match = pattern.search(f.active_option)
700-
selection += f'{f.active_option.split(": ")[1] if match else f.active_option} {"!" if f.negation else ""}{f.comparison} {value}'
701-
selection += "]"
702-
return selection
703-
704-
705-
# This needs to be moved into ui code, I know ;) - vulevukusej
706-
class IfcSelector(Operator):
707-
"""Select elements in model with IFC Selector"""
708-
709-
bl_idname = "bim.ifc_selector"
710-
bl_label = "Select elements with IFC Selector"
711-
712-
def invoke(self, context, event):
713-
return context.window_manager.invoke_props_dialog(self, width=800)
714-
715-
@classmethod
716-
def poll(cls, context):
717-
return IfcStore.get_file()
718-
719-
def execute(self, context):
720-
return {"FINISHED"}
721-
722-
def draw(self, context):
723-
from . import ui
724-
725-
ui.IfcSelectorUI.draw(context, self.layout)
726-
727-
728-
class SaveSelectorQuery(Operator):
729-
bl_idname = "bim.save_selector_query"
730-
bl_label = "Save Selector Query"
731-
save_name: StringProperty()
732-
733-
def invoke(self, context, event):
734-
return context.window_manager.invoke_props_dialog(self, width=400)
735-
736-
def draw(self, context):
737-
layout = self.layout
738-
layout.prop(self, "save_name")
739-
740-
def execute(self, context):
741-
ifc_selector = context.scene.IfcSelectorProperties
742-
new = ifc_selector.query_library.add()
743-
new.name = self.save_name
744-
new.query = ifc_selector.selector_query_syntax
745-
return {"FINISHED"}
746-
747-
748-
class OpenQueryLibrary(Operator):
749-
"""Open Query Library"""
750-
751-
bl_idname = "bim.open_query_library"
752-
bl_label = "Open Query Library"
753-
754-
def invoke(self, context, event):
755-
return context.window_manager.invoke_popup(self, width=400)
756-
757-
def draw(self, context):
758-
layout = self.layout
759-
ifc_selector = context.scene.IfcSelectorProperties
760-
761-
for index, query in enumerate(ifc_selector.query_library):
762-
row = layout.row(align=True)
763-
row.prop(query, "query", text=query.name)
764-
op = row.operator("bim.load_query", icon="SORT_ASC", text="")
765-
op.index = index
766-
767-
row.context_pointer_set(name="bim_prop_group", data=ifc_selector)
768-
op = row.operator("bim.edit_blender_collection", icon="REMOVE", text="")
769-
op.option = "remove"
770-
op.collection = "query_library"
771-
op.index = index
772-
773-
def execute(self, context):
774-
return {"FINISHED"}
775-
776-
777-
class LoadQuery(Operator):
778-
bl_idname = "bim.load_query"
779-
bl_label = "Load Query"
780-
index: IntProperty()
781-
782-
def invoke(self, context, event):
783-
close_operator_panel(event)
784-
return self.execute(context)
785-
786-
def execute(self, context):
787-
ifc_selector = context.scene.IfcSelectorProperties
788-
ifc_selector.selector_query_syntax = ifc_selector.query_library[self.index].query
789-
return {"FINISHED"}
790-
791-
792-
class AddToIfcGroup(Operator):
793-
bl_idname = "bim.add_to_ifc_group"
794-
bl_label = "Add to IFC Group"
795-
group_name: StringProperty(name="Group Name")
796-
797-
def invoke(self, context, event):
798-
bpy.ops.bim.load_groups()
799-
return context.window_manager.invoke_props_dialog(self, width=400)
800-
801-
def draw(self, context):
802-
self.props = context.scene.BIMGroupProperties
803-
row = self.layout.row()
804-
row.operator("bim.add_group")
805-
806-
self.layout.template_list(
807-
"BIM_UL_groups",
808-
"",
809-
self.props,
810-
"groups",
811-
self.props,
812-
"active_group_index",
813-
)
814-
815-
if self.props.active_group_id:
816-
for attribute in self.props.group_attributes:
817-
if attribute.name in ["Name", "Description"]:
818-
row = self.layout.row(align=True)
819-
row.prop(attribute, "string_value", text=attribute.name)
820-
821-
def execute(self, context):
822-
active_group_index = self.props.active_group_index
823-
ifc_definition_id = self.props.groups[active_group_index].ifc_definition_id
824-
825-
bpy.ops.bim.enable_editing_group(group=ifc_definition_id)
826-
827-
selector_query_syntax = context.scene.IfcSelectorProperties.selector_query_syntax
828-
829-
for attribute in self.props.group_attributes:
830-
if attribute.name == "Description":
831-
if "*selector*" not in attribute.string_value:
832-
attribute.string_value += f" *selector*{selector_query_syntax}*selector*"
833-
else:
834-
new_description = attribute.string_value.split("*selector*")
835-
new_description[1] = selector_query_syntax
836-
attribute.string_value = "*selector*".join(new_description)
837-
838-
bpy.ops.bim.edit_group()
839-
bpy.ops.bim.disable_group_editing_ui()
840-
return {"FINISHED"}
841-
842-
843626
class SelectSimilar(Operator, tool.Ifc.Operator):
844627
bl_idname = "bim.select_similar"
845628
bl_label = "Select Similar"

0 commit comments

Comments
 (0)