mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +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
|
return
|
||||||
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
builder = ifcopenshell.util.shape_builder.ShapeBuilder(tool.Ifc.get())
|
||||||
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(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]
|
faces = [p.vertices[:] for p in obj.data.polygons]
|
||||||
if item.is_a("IfcAdvancedBrep"):
|
if item.is_a("IfcAdvancedBrep"):
|
||||||
new_item = builder.faceted_brep(verts, faces)
|
new_item = builder.faceted_brep(verts, faces)
|
||||||
|
|||||||
@@ -1464,6 +1464,10 @@ class Geometry(bonsai.core.tool.Geometry):
|
|||||||
obj.data.clear_geometry()
|
obj.data.clear_geometry()
|
||||||
tool.Loader.convert_geometry_to_mesh(geometry, obj.data)
|
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"):
|
if item.is_a("IfcSweptAreaSolid"):
|
||||||
cls.record_object_position(obj)
|
cls.record_object_position(obj)
|
||||||
if item.Position:
|
if item.Position:
|
||||||
|
|||||||
@@ -921,7 +921,9 @@ class Loader(bonsai.core.tool.Loader):
|
|||||||
if "openings" not in rep_str:
|
if "openings" not in rep_str:
|
||||||
rep_id = rep_str.split("-", 1)[0]
|
rep_id = rep_str.split("-", 1)[0]
|
||||||
rep = tool.Ifc.get().by_id(int(rep_id))
|
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:
|
else:
|
||||||
e = geometry.edges
|
e = geometry.edges
|
||||||
v = verts
|
v = verts
|
||||||
|
|||||||
Reference in New Issue
Block a user