mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 06:21:40 +00:00
1) e.g. in ifc4x3 previously for IfcWall it would prioritize Qto_BodyGeometryValidation over Qto_WallBaseQuantities 2) It would also prioritize general Qto_BodyGeometryValidation over Qto_BuildingElementProxyQuantities. 3) removed "Qto_" check as we do qto_only in get_applicable_names
This commit is contained in:
@@ -79,7 +79,16 @@ class Qto(blenderbim.core.tool.Qto):
|
|||||||
product.is_a(), ifcopenshell.util.element.get_predefined_type(product), qto_only=True
|
product.is_a(), ifcopenshell.util.element.get_predefined_type(product), qto_only=True
|
||||||
)
|
)
|
||||||
# See https://github.com/buildingSMART/IFC4.3.x-development/issues/851 for anomalies in Qto naming
|
# See https://github.com/buildingSMART/IFC4.3.x-development/issues/851 for anomalies in Qto naming
|
||||||
return next((qto_name for qto_name in applicable_qto_names if "Qto_" in qto_name), None)
|
applicable_qto: Union[str, None] = None
|
||||||
|
for qto_name in applicable_qto_names:
|
||||||
|
# No need for "Qto_" check since we use qto_only=True.
|
||||||
|
if "Base" in qto_name:
|
||||||
|
return qto_name
|
||||||
|
# Prioritize anomaly named base quantities over Qto_BodyGeometryValidation.
|
||||||
|
if applicable_qto and "BodyGeometryValidation" not in applicable_qto:
|
||||||
|
continue
|
||||||
|
applicable_qto = qto_name
|
||||||
|
return applicable_qto
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_new_calculated_quantity(cls, qto_name: str, quantity_name: str, obj: bpy.types.Object) -> float:
|
def get_new_calculated_quantity(cls, qto_name: str, quantity_name: str, obj: bpy.types.Object) -> float:
|
||||||
|
|||||||
@@ -65,13 +65,26 @@ class TestGetApplicableBaseQuantityName(test.bim.bootstrap.NewFile):
|
|||||||
wall = ifc.createIfcWall()
|
wall = ifc.createIfcWall()
|
||||||
assert subject.get_applicable_base_quantity_name(wall) == "Qto_WallBaseQuantities"
|
assert subject.get_applicable_base_quantity_name(wall) == "Qto_WallBaseQuantities"
|
||||||
|
|
||||||
def test_no_base_quantity(self):
|
def test_no_quantities(self):
|
||||||
ifc = ifcopenshell.file()
|
ifc = ifcopenshell.file()
|
||||||
tool.Ifc.set(ifc)
|
tool.Ifc.set(ifc)
|
||||||
ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject")
|
ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject")
|
||||||
product = ifc.by_type("IfcProject")[0]
|
product = ifc.by_type("IfcProject")[0]
|
||||||
assert subject.get_applicable_base_quantity_name(product) == None
|
assert subject.get_applicable_base_quantity_name(product) == None
|
||||||
|
|
||||||
|
def test_anomaly_named_quantities(self):
|
||||||
|
ifc = ifcopenshell.file()
|
||||||
|
tool.Ifc.set(ifc)
|
||||||
|
product = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcBuildingElementProxy")
|
||||||
|
# Prioritized over Qto_BodyGeometryValidation.
|
||||||
|
assert subject.get_applicable_base_quantity_name(product) == "Qto_BuildingElementProxyQuantities"
|
||||||
|
|
||||||
|
def test_prioritize_base_over_other_qto(self):
|
||||||
|
ifc = ifcopenshell.file(schema="IFC4X3")
|
||||||
|
tool.Ifc.set(ifc)
|
||||||
|
product = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
|
||||||
|
assert subject.get_applicable_base_quantity_name(product) == "Qto_WallBaseQuantities"
|
||||||
|
|
||||||
|
|
||||||
class TestGetRoundedValue(test.bim.bootstrap.NewFile):
|
class TestGetRoundedValue(test.bim.bootstrap.NewFile):
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user