From e6691989dc378956099bfe3adefeaa11874fdf88 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 26 Feb 2024 13:27:36 +0100 Subject: [PATCH] #4283 convert closed wires to faces prior to processing in svg serializer --- src/serializers/SvgSerializer.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/serializers/SvgSerializer.cpp b/src/serializers/SvgSerializer.cpp index 92a58485a5..5bed15d1da 100644 --- a/src/serializers/SvgSerializer.cpp +++ b/src/serializers/SvgSerializer.cpp @@ -80,6 +80,7 @@ #include "../ifcparse/IfcGlobalId.h" #include "../ifcgeom_schema_agnostic/base_utils.h" #include "../ifcgeom_schema_agnostic/boolean_utils.h" +#include "../ifcgeom_schema_agnostic/wire_utils.h" #include #include @@ -704,6 +705,27 @@ void SvgSerializer::write(const IfcGeom::BRepElement* brep_obj) { compound_local = IfcGeom::util::unify(compound_local, 1.e-6); } + { + bool any_wires_converted_to_face = false; + BRep_Builder BB; + TopoDS_Compound comp2; + BB.MakeCompound(comp2); + TopoDS_Iterator it(compound_local); + for (; it.More(); it.Next()) { + auto& s = it.Value(); + if (s.ShapeType() == TopAbs_WIRE && s.Closed()) { + IfcGeom::util::wire_tolerance_settings wts{ false, false, Precision::Confusion(), Precision::Confusion() }; + TopoDS_Compound faces; + IfcGeom::util::convert_wire_to_faces(TopoDS::Wire(s), faces, wts); + BB.Add(comp2, faces); + any_wires_converted_to_face = true; + } else { + BB.Add(comp2, s); + } + } + compound_local = comp2; + } + geometry_data data{ compound_local, dash_arrays, trsf, brep_obj->product(), storey, elev, brep_obj->name(), nameElement(storey, brep_obj) }; if (auto_section_ || auto_elevation_ || section_ref_ || elevation_ref_ || elevation_ref_guid_ || deferred_section_data_) {