From 59336f5c9df8e052d80ada0cdd8343e9b898f38d Mon Sep 17 00:00:00 2001 From: abv Date: Fri, 18 Dec 2015 15:03:35 +0300 Subject: [PATCH] 0026951: Incorrect conversion of miles into millimeters during export to STEP Coefficient for conversion of miles to mm is corrected in UnitsMethods::GetLengthFactorValue() to be 1609344. In UnitsAPI/Units.dat, value of inch is corrected to be exactly 25.4 mm (it was 25.40001969); definition of nautical mile corrected to be exactly 1852 m. Test bugs fclasses bug26951 is added to check definition of mm and miles. DRAW command "unit" is corrected to put its output to Tcl instead of cout. --- src/Draw/Draw_UnitCommands.cxx | 4 ++-- src/UnitsAPI/Units.dat | 4 ++-- src/UnitsMethods/UnitsMethods.cxx | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Draw/Draw_UnitCommands.cxx b/src/Draw/Draw_UnitCommands.cxx index 07937c5ea9..217f9295cf 100644 --- a/src/Draw/Draw_UnitCommands.cxx +++ b/src/Draw/Draw_UnitCommands.cxx @@ -127,10 +127,10 @@ static Standard_Integer converttoMDTV //purpose : //======================================================================= -static Standard_Integer unit(Draw_Interpretor& , Standard_Integer n, const char** a) +static Standard_Integer unit(Draw_Interpretor& di, Standard_Integer n, const char** a) { if(n == 4) { - cout << Units::Convert(Draw::Atof(a[1]), a[2], a[3]) << endl; + di << Units::Convert(Draw::Atof(a[1]), a[2], a[3]); return 0; } else diff --git a/src/UnitsAPI/Units.dat b/src/UnitsAPI/Units.dat index 58581719d6..f797fdf710 100755 --- a/src/UnitsAPI/Units.dat +++ b/src/UnitsAPI/Units.dat @@ -41,7 +41,7 @@ micron mille mille 1852 m light year Al 9.46053E+15 m -inch in. 25.40001969E-03 m +inch in. 0.0254 m in caliber caliber 1 in. foot ft. 12 in @@ -51,7 +51,7 @@ yard yd. yd statute mile stat.mile 1760 yd. -nautical mile naut.mile 6080 ft. +nautical mile naut.mile 1852 m .................................................................................................................................... M L T I K N J P S TIME 0 0 1 0 0 0 0 0 0 diff --git a/src/UnitsMethods/UnitsMethods.cxx b/src/UnitsMethods/UnitsMethods.cxx index f4eb8cfdf4..f73b3ce965 100644 --- a/src/UnitsMethods/UnitsMethods.cxx +++ b/src/UnitsMethods/UnitsMethods.cxx @@ -414,17 +414,17 @@ void UnitsMethods::SetCasCadeLengthUnit (const Standard_Integer unit) Standard_Real UnitsMethods::GetLengthFactorValue (const Standard_Integer par) { switch ( par ) { - case 1 : return 25.4; - case 2 : return 1.; + case 1 : return 25.4; // inch + case 2 : return 1.; // millimeter - case 4 : return 304.8; - case 5 : return 1609270.; - case 6 : return 1000.; - case 7 : return 1000000.; - case 8 : return 0.0254; - case 9 : return 0.001; - case 10 : return 10.; - case 11 : return 0.0000254; + case 4 : return 304.8; // foot + case 5 : return 1609344.; // mile + case 6 : return 1000.; // meter + case 7 : return 1000000.; // kilometer + case 8 : return 0.0254; // mil (0.001 inch) + case 9 : return 0.001; // micron + case 10 : return 10.; // centimeter + case 11 : return 0.0000254; // microinch default : return 1.; } }