This commit is contained in:
Dion Moult
2026-07-26 18:03:09 +10:00
parent 7aa967b01a
commit 291d7d8441
72 changed files with 477 additions and 377 deletions
@@ -9,19 +9,20 @@ import ifcopenshell.util.shape
from pathlib import Path
repo_root = Path(__file__).resolve().parent.parent.parent.parent
test_files = repo_root / 'test' / 'input' / 'tests'
test_files = repo_root / "test" / "input" / "tests"
settings = ifcopenshell.geom.settings()
testdata = list(csv.reader((test_files / 'data.csv').open(newline='')))[1:]
testdata = list(csv.reader((test_files / "data.csv").open(newline="")))[1:]
print(testdata)
@pytest.mark.parametrize("fn,area,volume", testdata)
def test_conversion(fn, area, volume):
f = ifcopenshell.open(test_files / fn)
elem = next(inst for inst in f.by_type('IfcElement') if not inst.is_a('IfcOpeningElement'))
for kernel in ('manifold', 'opencascade', 'cgal'):
elem = next(inst for inst in f.by_type("IfcElement") if not inst.is_a("IfcOpeningElement"))
for kernel in ("manifold", "opencascade", "cgal"):
shp = ifcopenshell.geom.create_shape(settings, elem, geometry_library=kernel)
if area:
assert pytest.approx(float(area), rel=0.05) == ifcopenshell.util.shape.get_area(shp.geometry)