mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-28 11:18:18 +00:00
Type Manager : Add search to ifc class and descriptions to class an predefined type enums
This commit is contained in:
@@ -23,6 +23,7 @@ import ifcopenshell
|
|||||||
import blenderbim.tool as tool
|
import blenderbim.tool as tool
|
||||||
from blenderbim.bim.ifc import IfcStore
|
from blenderbim.bim.ifc import IfcStore
|
||||||
from blenderbim.bim.module.model.root import ConstrTypeEntityNotFound
|
from blenderbim.bim.module.model.root import ConstrTypeEntityNotFound
|
||||||
|
from blenderbim.bim.prop import get_ifc_entity_description, get_predefined_type_descriptions
|
||||||
|
|
||||||
|
|
||||||
def refresh():
|
def refresh():
|
||||||
@@ -60,7 +61,7 @@ class AuthoringData:
|
|||||||
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
|
declarations = ifcopenshell.util.schema.get_subtypes(declaration)
|
||||||
names = [d.name() for d in declarations]
|
names = [d.name() for d in declarations]
|
||||||
names.extend(("IfcDoorStyle", "IfcWindowStyle"))
|
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
|
@classmethod
|
||||||
def type_predefined_type(cls):
|
def type_predefined_type(cls):
|
||||||
@@ -68,7 +69,9 @@ class AuthoringData:
|
|||||||
declaration = tool.Ifc().schema().declaration_by_name(cls.props.type_class)
|
declaration = tool.Ifc().schema().declaration_by_name(cls.props.type_class)
|
||||||
for attribute in declaration.attributes():
|
for attribute in declaration.attributes():
|
||||||
if attribute.name() == "PredefinedType":
|
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
|
break
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import bpy
|
|||||||
from bpy.types import Panel, Operator, Menu
|
from bpy.types import Panel, Operator, Menu
|
||||||
from blenderbim.bim.module.model.data import AuthoringData
|
from blenderbim.bim.module.model.data import AuthoringData
|
||||||
from blenderbim.bim.module.model.prop import store_cursor_position
|
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):
|
class LaunchTypeManager(bpy.types.Operator):
|
||||||
@@ -46,7 +46,7 @@ class LaunchTypeManager(bpy.types.Operator):
|
|||||||
props = context.scene.BIMModelProperties
|
props = context.scene.BIMModelProperties
|
||||||
|
|
||||||
row = self.layout.row()
|
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)
|
columns = self.layout.column_flow(columns=3)
|
||||||
row = columns.row()
|
row = columns.row()
|
||||||
|
|||||||
Reference in New Issue
Block a user