Salome HOME
#1118 Crash the SALOME application after export
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_FaceBuilder.cpp
index fd014f73fafc53c9cf7e3b67b5baf5621efad207..8e108ebfa01d4f3423bba3c23f8a617500c69d60 100644 (file)
@@ -38,7 +38,8 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
                                        -theSize / 2., theSize / 2.,
                                        -theSize / 2., theSize / 2.);
   std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
-  aRes->setImpl(new TopoDS_Shape(aFaceBuilder.Face()));
+  TopoDS_Shape aFace = aFaceBuilder.Face();
+  aRes->setImpl(new TopoDS_Shape(aFace/*aFaceBuilder.Face()*/));
   return aRes;
 }
 
@@ -66,15 +67,16 @@ 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;
 }
 
-std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::planarFace(std::shared_ptr<GeomAPI_Ax1> theAxis)
-{
-  return planarFace(theAxis->origin(), theAxis->dir());
-}
-
 std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::planarFace(std::shared_ptr<GeomAPI_Pnt> theCenter,
                                                                    std::shared_ptr<GeomAPI_Dir> theNormal)
 {