]> OCCT Git - occt-copy.git/commitdiff
0026951: Incorrect conversion of miles into millimeters during export to STEP
authorabv <abv@opencascade.com>
Fri, 18 Dec 2015 12:03:35 +0000 (15:03 +0300)
committerbugmaster <bugmaster@opencascade.com>
Tue, 22 Dec 2015 11:08:52 +0000 (14:08 +0300)
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
src/UnitsAPI/Units.dat
src/UnitsMethods/UnitsMethods.cxx

index 07937c5ea9ac53d4721fcec0a3f0468eebcc1400..217f9295cf69f61c8fd1623a8c5cf321c1f04efa 100644 (file)
@@ -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
index 58581719d6cc16bfdf2dde41cc938376a39aaf79..f797fdf71032f172e2b85a0b729930ca32f82545 100755 (executable)
@@ -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
index f4eb8cfdf4193cc79b67ce78ba5dfa9a4cee7284..f73b3ce9656d9ce34896bd6830aa0eeedb6f365e 100644 (file)
@@ -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.;
   }
 }