200188 : fix problem with default ellipse creation mode when X axis is used as normal

This commit is contained in:
vsr 2009-03-03 10:28:05 +00:00
parent b7552c43c0
commit ba002ede34

View File

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