Salome HOME
200188 : fix problem with default ellipse creation mode when X axis is used as normal
authorvsr <vsr@opencascade.com>
Tue, 3 Mar 2009 10:28:05 +0000 (10:28 +0000)
committervsr <vsr@opencascade.com>
Tue, 3 Mar 2009 10:28:05 +0000 (10:28 +0000)
src/GEOMImpl/GEOMImpl_EllipseDriver.cxx

index 176ba05df87847634b3b2a088a43aed4e89115f6..4d5ec58d1ffb402a159b2e325574d51b1efd66cf 100644 (file)
@@ -103,8 +103,11 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const
         }
       }
     }
+
+    // Axes
+    gp_Ax2 anAxes (aP, aV);
+
     // Main Axis vector
-    gp_Vec aVM = gp::DX();
     Handle(GEOM_Function) aRefVectorMaj = aCI.GetVectorMajor();
     if (!aRefVectorMaj.IsNull()) {
       TopoDS_Shape aShapeVec = aRefVectorMaj->GetValue();
@@ -116,7 +119,7 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const
       TopoDS_Vertex V1, V2;
       TopExp::Vertices(anE, V1, V2, Standard_True);
       if (!V1.IsNull() && !V2.IsNull()) {
-        aVM = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
+       gp_Vec aVM (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
         if (aVM.Magnitude() < gp::Resolution()) {
           Standard_ConstructionError::Raise
             ("Ellipse creation aborted: major axis vector of zero length is given");
@@ -125,11 +128,11 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const
          Standard_ConstructionError::Raise
            ("Ellipse creation aborted: normal and major axis vectors are parallel");
        }
+       // Axes defined with main axis vector
+       anAxes  = gp_Ax2 (aP, aV, aVM);
       }
     }
 
-    // Axes
-    gp_Ax2 anAxes (aP, aV, aVM);
     // Ellipse
     gp_Elips anEll (anAxes, aCI.GetRMajor(), aCI.GetRMinor());
     aShape = BRepBuilderAPI_MakeEdge(anEll).Edge();