]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Porting Salome to OCCT 7.7.0
authorjfa <jfa@opencascade.com>
Fri, 10 Mar 2023 15:29:43 +0000 (15:29 +0000)
committerjfa <jfa@opencascade.com>
Fri, 10 Mar 2023 15:29:43 +0000 (15:29 +0000)
src/GeomAlgoAPI/GeomAlgoAPI_STLImport.cpp
src/Model/Model_ResultPart.cpp

index 65881759deddc5c79c69d246471ed1ed39fa1f39..90a2c78f01a3f8fff9d600d996d9774e1ced9c48 100644 (file)
 //
 
 #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));
index 903f253f72971d5c6059cd1e9f7a65402223c3f1..1cd3cb5be4110a8eaa81628ed8b9b0ef4e3c4b58 100644 (file)
@@ -18,6 +18,7 @@
 //
 
 #include <Model_ResultPart.h>
+
 #include <ModelAPI_Data.h>
 #include <Model_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
@@ -47,6 +48,8 @@
 #include <BRep_Builder.hxx>
 #include <TopExp_Explorer.hxx>
 
+#include <Basics_OCCTVersion.hxx>
+
 #define baseRef() \
   std::dynamic_pointer_cast<Model_ResultPart>(data()->reference(BASE_REF_ID())->value())
 
@@ -196,7 +199,11 @@ static GeomShapePtr transformShape(const GeomShapePtr theShape, const gp_Trsf& t
     // just update the location of the shape in case of affine transformation
     TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
     if (!aShape.IsNull()) {
+#if OCC_VERSION_LARGE < 0x07070000
       aShape.Move(theTrsf);
+#else
+      aShape.Move(theTrsf, Standard_False);
+#endif
       aResult->setImpl(new TopoDS_Shape(aShape));
     }
   }
@@ -289,7 +296,11 @@ std::wstring Model_ResultPart::nameInPart(const std::shared_ptr<GeomAPI_Shape>&
       TopExp_Explorer anExp(anOrigMain, aSelection.ShapeType());
       for(; anExp.More(); anExp.Next()) {
         if (anExp.Current().IsPartner(aSelection)) {
+#if OCC_VERSION_LARGE < 0x07070000
           TopoDS_Shape anOrigMoved = anExp.Current().Moved(*(myTrsf.get()));
+#else
+          TopoDS_Shape anOrigMoved = anExp.Current().Moved(*(myTrsf.get()), Standard_False);
+#endif
           //if (anOrigMoved.IsSame(aSelection)) {
           if (IsEqualTrsf(aSelTrsf, anOrigMoved.Location().Transformation())) {
             std::shared_ptr<GeomAPI_Shape> anOrigSel(new GeomAPI_Shape);
@@ -409,7 +420,11 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultPart::shapeInPart(
   aResult = aSelAttr->value(theIndex - 1)->value();
   if (myTrsf.get() && aResult.get() && !aResult->isNull()) {
     gp_Trsf aSumTrsf = sumTrsf();
+#if OCC_VERSION_LARGE < 0x07070000
     TopoDS_Shape anOrigMoved = aResult->impl<TopoDS_Shape>().Moved(aSumTrsf);
+#else
+    TopoDS_Shape anOrigMoved = aResult->impl<TopoDS_Shape>().Moved(aSumTrsf, Standard_False);
+#endif
     aResult->setImpl(new TopoDS_Shape(anOrigMoved));
   }
   return aResult;
@@ -426,7 +441,11 @@ std::shared_ptr<GeomAPI_Shape> Model_ResultPart::selectionValue(const int theInd
   aResult = aSelAttr->value(theIndex - 1)->value();
   if (myTrsf.get() && aResult.get() && !aResult->isNull()) {
     gp_Trsf aSumTrsf = sumTrsf();
+#if OCC_VERSION_LARGE < 0x07070000
     TopoDS_Shape anOrigMoved = aResult->impl<TopoDS_Shape>().Moved(aSumTrsf);
+#else
+    TopoDS_Shape anOrigMoved = aResult->impl<TopoDS_Shape>().Moved(aSumTrsf, Standard_False);
+#endif
     aResult->setImpl(new TopoDS_Shape(anOrigMoved));
   }
   return aResult;