Salome HOME
0017002: EDF 578 GEOM : Problem when trying to import some ACIS and IGES files
authordmv <dmv@opencascade.com>
Tue, 27 Oct 2009 13:43:20 +0000 (13:43 +0000)
committerdmv <dmv@opencascade.com>
Tue, 27 Oct 2009 13:43:20 +0000 (13:43 +0000)
src/IGESImport/IGESImport.cxx
src/STEPImport/STEPImport.cxx

index 3b28d20092e512a80d52d790d9f8bc962b01e0e3..3b272ac56e47b0fed51a0abcda7fb3e41aadee4c 100644 (file)
@@ -71,6 +71,10 @@ IGESIMPORT_EXPORT
                        TCollection_AsciiString&       theError,
                       const TDF_Label&)
   {
+    // Set "C" numeric locale to save numbers correctly
+    std::string aCurLocale = setlocale(LC_NUMERIC, 0);
+    setlocale(LC_NUMERIC, "C");
+
     IGESControl_Reader aReader;
     TopoDS_Shape aResShape;
     Interface_Static::SetCVal("xstep.cascade.unit","M");
@@ -99,6 +103,8 @@ IGESIMPORT_EXPORT
          TopoDS_Vertex V;
          B.MakeVertex(V,P,1.e-7);
          aResShape = V;
+          // Return previous locale before return from import
+          setlocale(LC_NUMERIC, aCurLocale.data());
          return aResShape;
        }
        if( theFormatName == "IGES_SCALE" ) {
@@ -149,6 +155,8 @@ IGESIMPORT_EXPORT
       theError = aFail->GetMessageString();
       aResShape.Nullify();
     }
+    // Return previous locale
+    setlocale(LC_NUMERIC, aCurLocale.data());
     return aResShape;
   }
 }
index f021d3a79ac31b5d64de6ae54e919b85108672ab..dc91b95ebd252c59e577fb8a84c95c9fed85a688 100644 (file)
@@ -74,6 +74,9 @@ STEPIMPORT_EXPORT
                       const TDF_Label&)
   {
     MESSAGE("Import STEP model from file " << theFileName.ToCString());
+    // Set "C" numeric locale to save numbers correctly
+    std::string aCurLocale = setlocale(LC_NUMERIC, 0);
+    setlocale(LC_NUMERIC, "C");
     TopoDS_Shape aResShape;
     //VRV: OCC 4.0 migration
     STEPControl_Reader aReader;
@@ -152,6 +155,8 @@ STEPIMPORT_EXPORT
       theError = aFail->GetMessageString();
       aResShape.Nullify();
     }
+    // Return previous locale
+    setlocale(LC_NUMERIC, aCurLocale.data());
     return aResShape;
   }
 }