ifcedit: include IfcSpace in default QTO element scope

IfcSpace is not a subtype of IfcElement, so quantify.run_quantify()'s
default selector silently skipped all spaces, reporting
elements_quantified: 0 with no error or warning.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Bruno Postle
2026-07-12 23:16:12 +01:00
parent 694a44e638
commit ab15750747
6 changed files with 24 additions and 5 deletions
+17
View File
@@ -85,3 +85,20 @@ class TestRunQuantify:
def test_empty_selector_runs_on_all(self, quantify_model):
result = run_quantify(quantify_model, "IFC4QtoBaseQuantities", selector=None)
assert result["ok"] is True
def test_default_selector_includes_spaces(self, quantify_model, monkeypatch):
"""IfcSpace is not a subtype of IfcElement, so the default scope must add it explicitly."""
import ifc5d.qto
seen_elements = {}
def fake_quantify(ifc_file, elements, rules):
seen_elements["elements"] = elements
return {}
monkeypatch.setattr(ifc5d.qto, "quantify", fake_quantify)
space = ifcopenshell.api.root.create_entity(quantify_model, ifc_class="IfcSpace", name="TestSpace")
run_quantify(quantify_model, "IFC4QtoBaseQuantities")
assert space in seen_elements["elements"]