mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
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:
@@ -1040,7 +1040,7 @@ class IfcImporter:
|
|||||||
if cartesian_point_offset is False:
|
if cartesian_point_offset is False:
|
||||||
mesh["has_cartesian_point_offset"] = False
|
mesh["has_cartesian_point_offset"] = False
|
||||||
elif cartesian_point_offset is not None:
|
elif cartesian_point_offset is not None:
|
||||||
verts -= cartesian_point_offset
|
verts = verts - cartesian_point_offset
|
||||||
|
|
||||||
mesh["has_cartesian_point_offset"] = True
|
mesh["has_cartesian_point_offset"] = True
|
||||||
mesh["cartesian_point_offset"] = (
|
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):
|
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
|
# Shift geometry close to the origin based off that first vert it found
|
||||||
verts_array = np.array(geometry.verts)
|
|
||||||
offset = verts[0]
|
offset = verts[0]
|
||||||
verts -= offset
|
verts = verts - offset
|
||||||
|
|
||||||
mesh["has_cartesian_point_offset"] = True
|
mesh["has_cartesian_point_offset"] = True
|
||||||
mesh["cartesian_point_offset"] = f"{offset[0]},{offset[1]},{offset[2]}"
|
mesh["cartesian_point_offset"] = f"{offset[0]},{offset[1]},{offset[2]}"
|
||||||
|
|||||||
@@ -1759,7 +1759,7 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
geometry = tool.Loader.create_generic_shape(item)
|
geometry = tool.Loader.create_generic_shape(item)
|
||||||
verts = ifcopenshell.util.shape.get_vertices(geometry)
|
verts = ifcopenshell.util.shape.get_vertices(geometry)
|
||||||
if (cartesian_point_offset := cls.get_cartesian_point_offset(rep_obj)) is not None:
|
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)
|
tool.Loader.convert_geometry_to_mesh(geometry, obj.data, verts=verts)
|
||||||
|
|
||||||
if ios_materials := list(obj.data["ios_materials"]):
|
if ios_materials := list(obj.data["ios_materials"]):
|
||||||
|
|||||||
Reference in New Issue
Block a user