Fix sign of temporary offset restore in sweep_along_curve

The temporary-offset workaround (#7408, commit bd57cc8735) subtracts the
directrix centroid (`mean`) from the curve points before building the
sweep near the origin, then must add it back to restore the original
location. The restore negated the sign — `Move(-mean)` instead of
`Move(+mean)` — placing the swept solid at -mean (mirrored through the
origin) rather than its true position.

Only triggers for polyline directrixes (`is_polyhedron()`) whose centroid
is more than 100 m from the origin (`mean.norm() > 1e2`), so models
centered near the origin are unaffected. Models that keep absolute site
coordinates (e.g. many Revit/ODA IFC exports) render affected swept
solids — reinforcing bars, pipes — at a mirrored phantom location far
from the rest of the model.
This commit is contained in:
Tiago Azevedo
2026-05-29 01:45:27 -03:00
committed by Thomas Krijnen
parent a3f92eb427
commit a433f56337
@@ -300,7 +300,11 @@ bool OpenCascadeKernel::convert(const taxonomy::sweep_along_curve::ptr scs, Topo
if (applied_temporary_offset) {
gp_Trsf trsf;
trsf.SetTranslation(gp_Vec(-mean.x(), -mean.y(), -mean.z()));
// Restore original position: add back the mean subtracted from the
// directrix points above. Previously negated, which placed the swept
// solid at -mean instead of its original location for geometry far
// from the origin.
trsf.SetTranslation(gp_Vec(mean.x(), mean.y(), mean.z()));
result.Move(trsf);
}