Type Manager : Add search to ifc class and descriptions to class an predefined type enums

This commit is contained in:
Gorgious56
2022-10-24 15:20:52 +02:00
parent 59bce590cc
commit 84020c9832
2 changed files with 7 additions and 4 deletions
@@ -23,6 +23,7 @@ import ifcopenshell
import blenderbim.tool as tool
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.module.model.root import ConstrTypeEntityNotFound
from blenderbim.bim.prop import get_ifc_entity_description, get_predefined_type_descriptions
def refresh():
@@ -60,7 +61,7 @@ class AuthoringData:
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
names = [d.name() for d in declarations]
names.extend(("IfcDoorStyle", "IfcWindowStyle"))
return [(c, c, "") for c in sorted(names)]
return [(c, c, get_ifc_entity_description(c)) for c in sorted(names)]
@classmethod
def type_predefined_type(cls):
@@ -68,7 +69,9 @@ class AuthoringData:
declaration = tool.Ifc().schema().declaration_by_name(cls.props.type_class)
for attribute in declaration.attributes():
if attribute.name() == "PredefinedType":
results.extend([(e, e, "") for e in attribute.type_of_attribute().declared_type().enumeration_items()])
declared_type = attribute.type_of_attribute().declared_type()
descriptions = get_predefined_type_descriptions(declared_type.name())
results.extend([(e, e, descriptions.get(e, "")) for e in declared_type.enumeration_items()])
break
return results
@@ -20,7 +20,7 @@ import bpy
from bpy.types import Panel, Operator, Menu
from blenderbim.bim.module.model.data import AuthoringData
from blenderbim.bim.module.model.prop import store_cursor_position
from blenderbim.bim.helper import prop_with_search, close_operator_panel
from blenderbim.bim.helper import prop_with_search
class LaunchTypeManager(bpy.types.Operator):
@@ -46,7 +46,7 @@ class LaunchTypeManager(bpy.types.Operator):
props = context.scene.BIMModelProperties
row = self.layout.row()
row.prop(props, "type_class", text="")
prop_with_search(row, props, "type_class", text="")
columns = self.layout.column_flow(columns=3)
row = columns.row()