Add ifcquery CLI tool for IFC model interrogation

This commit is contained in:
Bruno Postle
2026-03-23 23:22:47 +00:00
parent 8b8f78095d
commit cf3602bee1
35 changed files with 4454 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
# This file was generated with the assistance of an AI coding tool.
from ifcquery.tree import tree
class TestTree:
def test_root_is_project(self, model):
result = tree(model)
assert result["type"] == "IfcProject"
assert result["name"] == "TestProject"
def test_spatial_hierarchy(self, model):
result = tree(model)
# Project > Site > Building > Storey
site = result["children"][0]
assert site["type"] == "IfcSite"
assert site["name"] == "TestSite"
building = site["children"][0]
assert building["type"] == "IfcBuilding"
assert building["name"] == "TestBuilding"
storey = building["children"][0]
assert storey["type"] == "IfcBuildingStorey"
assert storey["name"] == "Ground Floor"
def test_contained_elements(self, model):
result = tree(model)
storey = result["children"][0]["children"][0]["children"][0]
elements = storey["elements"]
element_types = {e["type"] for e in elements}
assert "IfcWall" in element_types
assert "IfcSlab" in element_types
def test_element_ids_present(self, model):
result = tree(model)
assert "id" in result
assert isinstance(result["id"], int)