mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Loading and saving meshlike items now take into account georef cartesian point offsets
This commit is contained in:
@@ -1794,7 +1794,13 @@ class OverrideModeSetObject(bpy.types.Operator, tool.Ifc.Operator):
|
||||
return
|
||||
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(tool.Ifc.get())
|
||||
verts = [v.co / unit_scale for v in obj.data.vertices]
|
||||
|
||||
rep_obj = bpy.context.scene.BIMGeometryProperties.representation_obj
|
||||
if coordinate_offset := tool.Geometry.get_cartesian_point_offset(rep_obj):
|
||||
verts = [(v.co + coordinate_offset) / unit_scale for v in obj.data.vertices]
|
||||
else:
|
||||
verts = [v.co / unit_scale for v in obj.data.vertices]
|
||||
|
||||
faces = [p.vertices[:] for p in obj.data.polygons]
|
||||
if item.is_a("IfcAdvancedBrep"):
|
||||
new_item = builder.faceted_brep(verts, faces)
|
||||
|
||||
@@ -1464,6 +1464,10 @@ class Geometry(bonsai.core.tool.Geometry):
|
||||
obj.data.clear_geometry()
|
||||
tool.Loader.convert_geometry_to_mesh(geometry, obj.data)
|
||||
|
||||
if coordinate_offset := cls.get_cartesian_point_offset(props.representation_obj):
|
||||
for vert in obj.data.vertices:
|
||||
vert.co -= coordinate_offset
|
||||
|
||||
if item.is_a("IfcSweptAreaSolid"):
|
||||
cls.record_object_position(obj)
|
||||
if item.Position:
|
||||
|
||||
@@ -921,7 +921,9 @@ class Loader(bonsai.core.tool.Loader):
|
||||
if "openings" not in rep_str:
|
||||
rep_id = rep_str.split("-", 1)[0]
|
||||
rep = tool.Ifc.get().by_id(int(rep_id))
|
||||
tool.Loader.load_indexed_colour_map(rep, mesh)
|
||||
# For now, not necessary to load maps in Item mode
|
||||
if rep.is_a("IfcShapeRepresentation"):
|
||||
tool.Loader.load_indexed_colour_map(rep, mesh)
|
||||
else:
|
||||
e = geometry.edges
|
||||
v = verts
|
||||
|
||||
Reference in New Issue
Block a user