diff --git a/src/ifcopenshell-python/test/test_sql.py b/src/ifcopenshell-python/test/test_sql.py index 194bc7cf86..f065b3e824 100644 --- a/src/ifcopenshell-python/test/test_sql.py +++ b/src/ifcopenshell-python/test/test_sql.py @@ -17,6 +17,7 @@ # along with IfcOpenShell. If not, see . import pytest +import tempfile import test.bootstrap import ifcopenshell import ifcpatch @@ -29,8 +30,9 @@ SQLITE_PATH = None def get_ifc_sqlite() -> ifcopenshell.sqlite: global SQLITE_PATH if SQLITE_PATH is None: + tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".ifcsqlite") SQLITE_PATH = ifcpatch.execute( - {"file": ifcopenshell.open(TEST_FILE), "recipe": "Ifc2Sql", "arguments": ["sqlite"]} + {"file": ifcopenshell.open(TEST_FILE), "recipe": "Ifc2Sql", "arguments": ["sqlite", None, None, None, tmp.name]} ) assert isinstance(SQLITE_PATH, str) ifc_sqlite = ifcopenshell.open(SQLITE_PATH) diff --git a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py index de25c3f9ca..04d3cfa6ce 100644 --- a/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py +++ b/src/ifcpatch/ifcpatch/recipes/Ifc2Sql.py @@ -238,7 +238,8 @@ class Patcher: mids = np.array(shape.geometry.material_ids).tobytes() m = json.dumps([m.instance_id() for m in shape.geometry.materials]) self.geometry_rows[shape.geometry.id] = [shape.geometry.id, v, e, f, mids, m] - m = ifcopenshell.util.shape.get_shape_matrix(shape) + # Copy required since otherwise it is read-only + m = ifcopenshell.util.shape.get_shape_matrix(shape).copy() m[0][3] /= self.unit_scale m[1][3] /= self.unit_scale m[2][3] /= self.unit_scale