Fix bug where UI didn't show applicable psets to specific predefined types

This commit is contained in:
Dion Moult
2024-01-13 16:49:02 +11:00
parent 608147c245
commit c8456532ad
3 changed files with 23 additions and 12 deletions
@@ -91,7 +91,9 @@ class ObjectPsetsData(Data):
element = tool.Ifc.get_entity(obj) element = tool.Ifc.get_entity(obj)
if not element: if not element:
return [] return []
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(element.is_a(), pset_only=True) psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(
element.is_a(), ifcopenshell.util.element.get_predefined_type(element), pset_only=True
)
psetnames = cls.format_pset_enum(psets) psetnames = cls.format_pset_enum(psets)
assigned_names = ifcopenshell.util.element.get_psets(element, psets_only=True, should_inherit=False).keys() assigned_names = ifcopenshell.util.element.get_psets(element, psets_only=True, should_inherit=False).keys()
return [p for p in psetnames if p[0] not in assigned_names] return [p for p in psetnames if p[0] not in assigned_names]
@@ -102,7 +104,9 @@ class ObjectPsetsData(Data):
element = tool.Ifc.get_entity(obj) element = tool.Ifc.get_entity(obj)
if not element: if not element:
return [] return []
qtos = blenderbim.bim.schema.ifc.psetqto.get_applicable(element.is_a(), qto_only=True) qtos = blenderbim.bim.schema.ifc.psetqto.get_applicable(
element.is_a(), ifcopenshell.util.element.get_predefined_type(element), qto_only=True
)
return cls.format_pset_enum(qtos) return cls.format_pset_enum(qtos)
@classmethod @classmethod
+6 -1
View File
@@ -56,7 +56,12 @@ class Pset(blenderbim.core.tool.Pset):
@classmethod @classmethod
def is_pset_applicable(cls, element, pset_name): def is_pset_applicable(cls, element, pset_name):
return bool(pset_name in blenderbim.bim.schema.ifc.psetqto.get_applicable_names(element.is_a(), pset_only=True)) return bool(
pset_name
in blenderbim.bim.schema.ifc.psetqto.get_applicable_names(
element.is_a(), ifcopenshell.util.element.get_predefined_type(element), pset_only=True
)
)
@classmethod @classmethod
def is_pset_empty(cls, pset): def is_pset_empty(cls, pset):
+3 -1
View File
@@ -70,7 +70,9 @@ class Qto(blenderbim.core.tool.Qto):
def get_applicable_base_quantity_name(cls, product=None): def get_applicable_base_quantity_name(cls, product=None):
if not product: if not product:
return return
applicable_qto_names = blenderbim.bim.schema.ifc.psetqto.get_applicable_names(product.is_a(), qto_only=True) applicable_qto_names = blenderbim.bim.schema.ifc.psetqto.get_applicable_names(
product.is_a(), ifcopenshell.util.element.get_predefined_type(product), qto_only=True
)
return next((qto_name for qto_name in applicable_qto_names if "Qto_" in qto_name and "Base" in qto_name), None) return next((qto_name for qto_name in applicable_qto_names if "Qto_" in qto_name and "Base" in qto_name), None)
@classmethod @classmethod