From 5e84d8da83d9383aea074b97ad1fb97512384189 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sat, 30 Jan 2021 16:15:26 +0100 Subject: [PATCH] SVG Move section/elevation to origin to workaround PolyHLR bug --- src/serializers/SvgSerializer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/serializers/SvgSerializer.cpp b/src/serializers/SvgSerializer.cpp index cfb05171f8..c718680f7d 100644 --- a/src/serializers/SvgSerializer.cpp +++ b/src/serializers/SvgSerializer.cpp @@ -74,6 +74,8 @@ #include +#include + #include "../ifcparse/IfcGlobalId.h" #include "SvgSerializer.h" @@ -383,6 +385,14 @@ void SvgSerializer::write(const IfcGeom::BRepElement* brep_obj) { crv->D1((u0 + u1) / 2., P, V); auto N = V.Crossed(gp::DZ()); gp_Pln pln(gp_Ax3(P, N, V)); + + // Move pln to have projection of origin at plane center. + // This is necessary to have Poly and BRep HLR at the same position + // (Poly) is wrong otherwise. + Extrema_ExtPElS ext; + ext.Perform(gp::Origin(), pln, 1.e-5); + pln.SetLocation(ext.Point(1).Value()); + if (!deferred_section_data_) { deferred_section_data_.emplace(); }