3232#include < Geom_BezierCurve.hxx>
3333#include < ShapeAnalysis_Edge.hxx>
3434#include < ShapeAnalysis_WireOrder.hxx>
35+ #include < ShapeUpgrade_UnifySameDomain.hxx>
3536#include < TopoDS.hxx>
3637#include < TopoDS_Shape.hxx>
3738#include < gp_Ax2.hxx>
@@ -429,6 +430,21 @@ class ShapeFactory {
429430 return ShapeResult { makeThickSolid.Shape (), true , " " };
430431 }
431432
433+ static ShapeResult simplifyShape (
434+ const TopoDS_Shape& shape,
435+ const Standard_Boolean theUnifyEdges,
436+ const Standard_Boolean theUnifyFaces)
437+ {
438+ if (!theUnifyEdges && !theUnifyFaces) {
439+ return ShapeResult { shape, true , " " };
440+ }
441+
442+ ShapeUpgrade_UnifySameDomain anUnifier (shape, theUnifyEdges, theUnifyFaces, Standard_True);
443+ anUnifier.Build ();
444+
445+ return ShapeResult { anUnifier.Shape (), true , " " };
446+ }
447+
432448 static ShapeResult booleanOperate (BRepAlgoAPI_BooleanOperation& boolOperater, const ShapeArray& args,
433449 const ShapeArray& tools)
434450 {
@@ -442,7 +458,6 @@ class ShapeFactory {
442458 if (!boolOperater.IsDone ()) {
443459 return ShapeResult { TopoDS_Shape (), false , " Failed to build boolean operation" };
444460 }
445- boolOperater.SimplifyResult ();
446461
447462 return ShapeResult { boolOperater.Shape (), true , " " };
448463 }
@@ -555,6 +570,7 @@ EMSCRIPTEN_BINDINGS(ShapeFactory)
555570 .class_function (" solid" , &ShapeFactory::solid)
556571 .class_function (" makeThickSolidBySimple" , &ShapeFactory::makeThickSolidBySimple)
557572 .class_function (" makeThickSolidByJoin" , &ShapeFactory::makeThickSolidByJoin)
573+ .class_function (" simplifyShape" , &ShapeFactory::simplifyShape)
558574 .class_function (" booleanCommon" , &ShapeFactory::booleanCommon)
559575 .class_function (" booleanCut" , &ShapeFactory::booleanCut)
560576 .class_function (" booleanFuse" , &ShapeFactory::booleanFuse)
0 commit comments