]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
import stl: put result into solid
authorrraphael <raphael.raphael@c-s.fr>
Fri, 11 Dec 2020 13:24:48 +0000 (14:24 +0100)
committerrraphael <raphael.raphael@c-s.fr>
Fri, 15 Jan 2021 11:10:10 +0000 (12:10 +0100)
src/GeomAlgoAPI/GeomAlgoAPI_STLImport.cpp

index 1c0c6ce4cba90589f71c1877ae731b781218f625..f7ecae9d0c825f28f4bbdf64327a1271abeae070 100644 (file)
@@ -21,7 +21,9 @@
 #include "GeomAlgoAPI_Tools.h"
 #include <TopoDS_Shape.hxx>
 #include <StlAPI_Reader.hxx>
-
+#include <TopoDS_Shell.hxx>
+#include <TopoDS.hxx>
+#include <BRepBuilderAPI_MakeSolid.hxx>
 
 std::shared_ptr<GeomAPI_Shape> STLImport(const std::string& theFileName,
                                          std::string& theError)
@@ -36,6 +38,13 @@ std::shared_ptr<GeomAPI_Shape> STLImport(const std::string& theFileName,
       theError = "Can't import file.";
       aResShape.Nullify();
     }
+    if(aResShape.ShapeType() == TopAbs_SHELL)
+    {
+      BRepBuilderAPI_MakeSolid soliMaker(TopoDS::Shell(aResShape));
+      soliMaker.Build();
+      if(soliMaker.IsDone())
+        aResShape = soliMaker.Shape();
+    }
   }
   catch (Standard_Failure const& anException) {
     theError = anException.GetMessageString();