Fix recent regression where util.shape.get_vertices returns a read-only array, so you can't edit in place (e.g. for offsets)

This commit is contained in:
Dion Moult
2025-02-14 13:06:04 +11:00
parent 768bf17b05
commit 3832077d0f
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -1040,7 +1040,7 @@ class IfcImporter:
if cartesian_point_offset is False:
mesh["has_cartesian_point_offset"] = False
elif cartesian_point_offset is not None:
verts -= cartesian_point_offset
verts = verts - cartesian_point_offset
mesh["has_cartesian_point_offset"] = True
mesh["cartesian_point_offset"] = (
@@ -1048,9 +1048,8 @@ class IfcImporter:
)
elif verts.size and tool.Loader.is_point_far_away(verts[0], is_meters=True):
# Shift geometry close to the origin based off that first vert it found
verts_array = np.array(geometry.verts)
offset = verts[0]
verts -= offset
verts = verts - offset
mesh["has_cartesian_point_offset"] = True
mesh["cartesian_point_offset"] = f"{offset[0]},{offset[1]},{offset[2]}"
+1 -1
View File
@@ -1759,7 +1759,7 @@ class Geometry(bonsai.core.tool.Geometry):
geometry = tool.Loader.create_generic_shape(item)
verts = ifcopenshell.util.shape.get_vertices(geometry)
if (cartesian_point_offset := cls.get_cartesian_point_offset(rep_obj)) is not None:
verts -= cartesian_point_offset
verts = verts - cartesian_point_offset
tool.Loader.convert_geometry_to_mesh(geometry, obj.data, verts=verts)
if ios_materials := list(obj.data["ios_materials"]):