From d8b1ea33f89a9693f61f69f6e12d16c343f37126 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 9 Aug 2021 10:59:24 +0200 Subject: [PATCH] remove internal edges in 2D fuse --- libsrc/occ/python_occ_shapes.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index ab3ac396..c62cb841 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4 #define OCC_HAVE_DUMP_JSON @@ -367,7 +368,13 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) { return shape.Located(loc); }) .def("__add__", [] (const TopoDS_Shape & shape1, const TopoDS_Shape & shape2) { - return BRepAlgoAPI_Fuse(shape1, shape2).Shape(); + auto fused = BRepAlgoAPI_Fuse(shape1, shape2).Shape(); + + // make one face when fusing in 2D + // from https://gitlab.onelab.info/gmsh/gmsh/-/issues/627 + ShapeUpgrade_UnifySameDomain unify(fused, true, true, true); + unify.Build(); + return unify.Shape(); }) .def("__mul__", [] (const TopoDS_Shape & shape1, const TopoDS_Shape & shape2) {