1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-03 17:56:21 +03:00

0023597: Failed to export ellipse into STEP with units other than mm

Test case for this bug
This commit is contained in:
Roman Lygin 2012-12-07 12:47:03 +04:00
parent 0d167958d9
commit 72ae989503
2 changed files with 43 additions and 47 deletions

View File

@ -155,24 +155,12 @@ Handle(Geom2d_Curve) UnitsMethods::RadianToDegree
}
else if (theSurf->IsKind(STANDARD_TYPE(Geom_Plane))) {
uFact = vFact = LengthFact;
if (aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
Handle(Geom2d_Circle) newCircle =
Handle(Geom2d_Circle)::DownCast(aCurve2d);
gp_Pnt2d Loc = newCircle->Location();
Loc.SetX(Loc.X()*LengthFact);
Loc.SetY(Loc.Y()*LengthFact);
newCircle->SetRadius(newCircle->Radius()*LengthFact);
return newCircle;
}
else if (aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
Handle(Geom2d_Ellipse) newEllipse =
Handle(Geom2d_Ellipse)::DownCast(aCurve2d);
gp_Pnt2d Loc = newEllipse->Location();
Loc.SetX(Loc.X()*LengthFact);
Loc.SetY(Loc.Y()*LengthFact);
newEllipse->SetMajorRadius(newEllipse->MajorRadius()*LengthFact);
newEllipse->SetMinorRadius(newEllipse->MinorRadius()*LengthFact);
return newEllipse;
if (aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Circle)) ||
aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
gp_Trsf2d aT;
aT.SetScale (gp::Origin2d(), LengthFact);
aCurve2d->Transform (aT);
return aCurve2d;
}
}
else {
@ -200,20 +188,12 @@ Handle(Geom2d_Curve) UnitsMethods::RadianToDegree
return myNewLine2d;
}
else if (aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Conic))) {
if (aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
Handle(Geom2d_Circle) aCirc2d =
Handle(Geom2d_Circle)::DownCast(aCurve2d);
if (aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Circle)) ||
aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
Handle(Geom2d_BSplineCurve) aBSpline2d =
Geom2dConvert::CurveToBSplineCurve(aCirc2d);
Geom2dConvert::CurveToBSplineCurve(aCurve2d);
aCurve2d = aBSpline2d;
}
else if (aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
Handle(Geom2d_Ellipse) aHel2d =
Handle(Geom2d_Ellipse)::DownCast(aCurve2d);
Handle(Geom2d_BSplineCurve) aBSpline2d =
Geom2dConvert::CurveToBSplineCurve(aHel2d);
aCurve2d = aBSpline2d;
}
else if (aCurve2d->IsKind(STANDARD_TYPE(Geom2d_Parabola))) {
#ifdef DEBUG
cout << "PCURVE of Parabola type in U or V Periodic Surface" << endl;
@ -304,24 +284,12 @@ Handle(Geom2d_Curve) UnitsMethods::DegreeToRadian
}
else if (aSurface->IsKind(STANDARD_TYPE(Geom_Plane))) {
uFact = vFact = LengthFact;
if (aPcurve->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
Handle(Geom2d_Circle) newCircle =
Handle(Geom2d_Circle)::DownCast(aPcurve);
gp_Pnt2d Loc = newCircle->Location();
Loc.SetX(Loc.X()*LengthFact);
Loc.SetY(Loc.Y()*LengthFact);
newCircle->SetRadius(newCircle->Radius()*LengthFact);
return newCircle;
}
else if (aPcurve->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
Handle(Geom2d_Ellipse) newEllipse =
Handle(Geom2d_Ellipse)::DownCast(aPcurve);
gp_Pnt2d Loc = newEllipse->Location();
Loc.SetX(Loc.X()*LengthFact);
Loc.SetY(Loc.Y()*LengthFact);
newEllipse->SetMajorRadius(newEllipse->MajorRadius()*LengthFact);
newEllipse->SetMinorRadius(newEllipse->MinorRadius()*LengthFact);
return newEllipse;
if (aPcurve->IsKind(STANDARD_TYPE(Geom2d_Circle)) ||
aPcurve->IsKind(STANDARD_TYPE(Geom2d_Ellipse))) {
gp_Trsf2d aT;
aT.SetScale (gp::Origin2d(), LengthFact);
aPcurve->Transform (aT);
return aPcurve;
}
}
else {

28
tests/bugs/xde/bug23597 Executable file
View File

@ -0,0 +1,28 @@
puts "================"
puts "OCC23597"
puts "================"
puts ""
#######################################################################
# Failed to export ellipse into STEP with units other than mm
#######################################################################
set filedir ${imagedir}
set TheFileName bug23597_f-ellipse
if { [file exists ${filedir}/${TheFileName}.stp] } {
puts "Error : There is old ${filedir}/${TheFileName}.stp file"
}
xnorm STEP
restore [locate_data_file ${TheFileName}.brep] f
param write.step.unit FT
newmodel
stepwrite a f ${filedir}/${TheFileName}.stp
if { ![file exists ${filedir}/${TheFileName}.stp] } {
puts "Error : There is not ${filedir}/${TheFileName}.stp file"
}
catch {exec chmod 777 ${filedir}/${TheFileName}.stp }
file delete ${filedir}/${TheFileName}.stp