Salome HOME
bos #41438 [CEA][Windows] SHAPER compilation fails in debug mode
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_STLImport.cpp
index f7ecae9d0c825f28f4bbdf64327a1271abeae070..0f714ef3c5819837cb2b4c5cbc5198c08afb234e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 
 #include <GeomAlgoAPI_STLImport.h>
+
 #include "GeomAlgoAPI_Tools.h"
+
+#include <Basics_OCCTVersion.hxx>
+
+#include <TopoDS.hxx>
 #include <TopoDS_Shape.hxx>
-#include <StlAPI_Reader.hxx>
 #include <TopoDS_Shell.hxx>
-#include <TopoDS.hxx>
 #include <BRepBuilderAPI_MakeSolid.hxx>
+#include <BRepBuilderAPI_Sewing.hxx>
+#include <StlAPI_Reader.hxx>
 
 std::shared_ptr<GeomAPI_Shape> STLImport(const std::string& theFileName,
                                          std::string& theError)
@@ -38,6 +43,15 @@ std::shared_ptr<GeomAPI_Shape> STLImport(const std::string& theFileName,
       theError = "Can't import file.";
       aResShape.Nullify();
     }
+#if OCC_VERSION_LARGE >= 0x07070000
+    BRepBuilderAPI_Sewing aSewingTool;
+    aSewingTool.Init(1.0e-06, Standard_True);
+    aSewingTool.Load(aResShape);
+    aSewingTool.Perform();
+    TopoDS_Shape aSewedShape = aSewingTool.SewedShape();
+    if (!aSewedShape.IsNull())
+      aResShape = aSewedShape;
+#endif
     if(aResShape.ShapeType() == TopAbs_SHELL)
     {
       BRepBuilderAPI_MakeSolid soliMaker(TopoDS::Shell(aResShape));