Salome HOME
#1118 Crash the SALOME application after export
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_FaceBuilder.cpp
index 9e687d6d296aa65d1b726313f7338747d5cecaab..8e108ebfa01d4f3423bba3c23f8a617500c69d60 100644 (file)
@@ -31,8 +31,7 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
 
 std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
     std::shared_ptr<GeomAPI_Pln> thePlane,
-    const double theSize,
-    const bool theInfinite)
+    const double theSize)
 {
   // half of the size in each direction from the center
   BRepBuilderAPI_MakeFace aFaceBuilder(thePlane->impl<gp_Pln>(),
@@ -40,8 +39,6 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
                                        -theSize / 2., theSize / 2.);
   std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
   TopoDS_Shape aFace = aFaceBuilder.Face();
-  if (theInfinite)
-    aFace.Infinite(Standard_True);
   aRes->setImpl(new TopoDS_Shape(aFace/*aFaceBuilder.Face()*/));
   return aRes;
 }
@@ -70,6 +67,12 @@ std::shared_ptr<GeomAPI_Pln> GeomAlgoAPI_FaceBuilder::plane(
   gp_Pln aPln = isPlanar.Plan();
   double aA, aB, aC, aD;
   aPln.Coefficients(aA, aB, aC, aD);
+  if (aFace.Orientation() == TopAbs_REVERSED) {
+    aA = -aA;
+    aB = -aB;
+    aC = -aC;
+    aD = -aD;
+  }
   aResult = std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
   return aResult;
 }