bsdd - info messages with amount of found classes / class props

This commit is contained in:
Andrej730
2024-07-25 18:36:11 +05:00
parent e4afcc96d1
commit d51fa2c5f7
3 changed files with 18 additions and 8 deletions
@@ -47,19 +47,23 @@ class SetActiveBSDDDictionary(bpy.types.Operator):
class SearchBSDDClass(bpy.types.Operator):
bl_idname = "bim.search_bsdd_classifications"
bl_label = "Search bSDD Class"
bl_description = "Search for bSDD classes by the provided keyword"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
keyword = context.scene.BIMBSDDProperties.keyword
core.search_class(keyword, bsdd.Client(), tool.Bsdd)
classes_found = core.search_class(keyword, bsdd.Client(), tool.Bsdd)
self.report({"INFO"}, f"{classes_found} bSDD classes found for '{keyword}'.")
return {"FINISHED"}
class GetBSDDClassificationProperties(bpy.types.Operator):
bl_idname = "bim.get_bsdd_classification_properties"
bl_label = "Search bSDD Classifications"
bl_label = "Search bSDD Class Properties"
bl_description = "Search for bSDD class properties for the currently selected class"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
core.get_class_properties(bsdd.Client(), tool.Bsdd)
properties_found = core.get_class_properties(bsdd.Client(), tool.Bsdd)
self.report({"INFO"}, f"{properties_found} properties found for the active classification.")
return {"FINISHED"}
@@ -62,7 +62,11 @@ class BIMBSDDProperties(PropertyGroup):
classifications: CollectionProperty(name="Classifications", type=BSDDClassification)
active_classification_index: IntProperty(name="Active Classification Index")
keyword: StringProperty(name="Keyword")
should_filter_ifc_class: BoolProperty(name="Filter Active IFC Class", default=True)
should_filter_ifc_class: BoolProperty(
name="Filter Active IFC Class",
description="Whether to search only for bSDD classes that match active object's IFC class",
default=True,
)
load_preview_domains: BoolProperty(
name="Load Preview Domains", description="Whether it should load preview and inactive domains", default=False
)
+6 -4
View File
@@ -26,13 +26,14 @@ if TYPE_CHECKING:
import blenderbim.tool as tool
def get_class_properties(client: bsdd.Client, bsdd: tool.Bsdd) -> None:
def get_class_properties(client: bsdd.Client, bsdd: tool.Bsdd) -> int:
bsdd.clear_class_psets()
data = bsdd.get_active_class_data(client)
pset_dict = bsdd.get_property_dict(data)
if pset_dict is None:
return
return 0
bsdd.create_class_psets(pset_dict)
return len(pset_dict)
def load_bsdd(client: bsdd.Client, bsdd: tool.Bsdd) -> None:
@@ -44,14 +45,15 @@ def load_bsdd(client: bsdd.Client, bsdd: tool.Bsdd) -> None:
bsdd.create_dictionaries(dictionaries)
def search_class(keyword: str, client: bsdd.Client, bsdd: tool.Bsdd) -> None:
def search_class(keyword: str, client: bsdd.Client, bsdd: tool.Bsdd) -> int:
bsdd.clear_classes()
if len(keyword) < 3:
return
return 0
related_entities = bsdd.get_related_ifc_entities(keyword)
active_dictionary_uri = bsdd.get_active_dictionary_uri()
classes = bsdd.search_class(client, keyword, [active_dictionary_uri], related_entities)
bsdd.create_classes(classes)
return len(classes)
def set_active_bsdd_dictionary(name: str, uri: str, bsdd: tool.Bsdd) -> None: