From e59444bf0e160160843b05d6db738de430cb7c31 Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 27 Oct 2009 13:43:20 +0000 Subject: [PATCH] 0017002: EDF 578 GEOM : Problem when trying to import some ACIS and IGES files --- src/IGESImport/IGESImport.cxx | 8 ++++++++ src/STEPImport/STEPImport.cxx | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/IGESImport/IGESImport.cxx b/src/IGESImport/IGESImport.cxx index 3b28d2009..3b272ac56 100644 --- a/src/IGESImport/IGESImport.cxx +++ b/src/IGESImport/IGESImport.cxx @@ -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; } } diff --git a/src/STEPImport/STEPImport.cxx b/src/STEPImport/STEPImport.cxx index f021d3a79..dc91b95eb 100644 --- a/src/STEPImport/STEPImport.cxx +++ b/src/STEPImport/STEPImport.cxx @@ -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; } } -- 2.39.2