diff --git a/src/serializers/SvgSerializer.cpp b/src/serializers/SvgSerializer.cpp index d8a6958369..20fe38ac0c 100644 --- a/src/serializers/SvgSerializer.cpp +++ b/src/serializers/SvgSerializer.cpp @@ -52,6 +52,8 @@ #include #include +#include + #include "../ifcparse/IfcGlobalId.h" #include "SvgSerializer.h" @@ -310,7 +312,16 @@ void SvgSerializer::write(const IfcGeom::BRepElement* o) path_object& p = start_path(storey, nameElement(o)); + // SVG has a coordinate system with the origin in the *upper*-left corner + // therefore we mirror the shape along the XZ-plane. TopoDS_Shape compound = o->geometry().as_compound(); + gp_Trsf trsf; + trsf.SetMirror(gp_Ax2(gp::Origin(), gp::DY())); + BRepBuilderAPI_Transform make_transform(compound, trsf); + make_transform.Build(); + // When determinant < 0, copy is implied and the input is not mutated. + compound = make_transform.Shape(); + TopoDS_Iterator it(compound); // Iterate over components of compound to have better chance of matching section edges to closed wires