From 0e084f283063216cf069b54e00a85dc3c128dc78 Mon Sep 17 00:00:00 2001 From: CyrilWaechter Date: Mon, 17 Aug 2026 23:17:09 +0200 Subject: [PATCH] Port space/boundary code to v0.9.0 API changes v0.9.0 changed two APIs used by the space generation feature: 1. geom.tree.select_ray no longer accepts length as a keyword argument; pass it positionally. 2. ifcopenshell.file no longer exposes wrapped_data; serialize with file.to_string() directly. Generated with the assistance of an AI coding tool. --- src/ifcopenshell-python/ifcopenshell/util/space.py | 2 +- src/ifcopenshell-python/test/util/test_boundary.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/space.py b/src/ifcopenshell-python/ifcopenshell/util/space.py index 31aa34b4c6..33da734a22 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/space.py +++ b/src/ifcopenshell-python/ifcopenshell/util/space.py @@ -261,7 +261,7 @@ def _nearest_ray_hits( """Nearest hit per origin; select_ray returns all hits including duplicates.""" hits = [] for origin in origins: - results = sorted(tree.select_ray(origin, ray_dir, length=1e4), key=lambda h: h.distance) + results = sorted(tree.select_ray(origin, ray_dir, 1e4), key=lambda h: h.distance) if results: hits.append(results[0]) return hits diff --git a/src/ifcopenshell-python/test/util/test_boundary.py b/src/ifcopenshell-python/test/util/test_boundary.py index 2eedf72746..6b15f3e491 100644 --- a/src/ifcopenshell-python/test/util/test_boundary.py +++ b/src/ifcopenshell-python/test/util/test_boundary.py @@ -367,7 +367,7 @@ class TestAutoGenerateBoundaries(test.bootstrap.IFC4): (440, {1122: 1, 3140: 1, 3214: 1, 3493: 1, 3605: 1, 3640: 1, 3669: 1, 3719: 1}), (628, {3140: 1, 3838: 1, 3927: 1, 3980: 2, 4033: 1, 4086: 1, 4139: 1, 4199: 1}), ]: - copy = ifcopenshell.file.from_string(ifc_file.wrapped_data.to_string()) + copy = ifcopenshell.file.from_string(ifc_file.to_string()) new_space = copy.by_id(space_id) result = subject.auto_generate_boundaries( copy, new_space, shapes=shapes, boundary_class="IfcRelSpaceBoundary2ndLevel" @@ -398,7 +398,7 @@ class TestAutoGenerateBoundaries(test.bootstrap.IFC4): pytest.skip("IfcRelSpaceBoundary_TestFiles submodule is not checked out") ifc_file = ifcopenshell.open(ifc_path) shapes = _build_shapes_dict_from_iterator(ifc_file) - copy = ifcopenshell.file.from_string(ifc_file.wrapped_data.to_string()) + copy = ifcopenshell.file.from_string(ifc_file.to_string()) result = subject.auto_generate_boundaries( copy, copy.by_id(251), shapes=shapes, boundary_class="IfcRelSpaceBoundary" ) @@ -421,7 +421,7 @@ class TestAutoGenerateBoundaries(test.bootstrap.IFC4): ifc_file = ifcopenshell.open(ifc_path) shapes = _build_shapes_dict_from_iterator(ifc_file) for space_id, expected_total in [(1692, 8), (4356, 8), (4380, 13), (6185, 1)]: - copy = ifcopenshell.file.from_string(ifc_file.wrapped_data.to_string()) + copy = ifcopenshell.file.from_string(ifc_file.to_string()) result = subject.auto_generate_boundaries( copy, copy.by_id(space_id), shapes=shapes, boundary_class="IfcRelSpaceBoundary2ndLevel" ) @@ -433,7 +433,7 @@ class TestAutoGenerateBoundaries(test.bootstrap.IFC4): pytest.skip("IfcRelSpaceBoundary_TestFiles submodule is not checked out") ifc_file = ifcopenshell.open(ifc_path) shapes = _build_shapes_dict_from_iterator(ifc_file) - copy = ifcopenshell.file.from_string(ifc_file.wrapped_data.to_string()) + copy = ifcopenshell.file.from_string(ifc_file.to_string()) result = subject.auto_generate_boundaries( copy, copy.by_id(1573), shapes=shapes, boundary_class="IfcRelSpaceBoundary2ndLevel" )