0017002: EDF 578 GEOM : Problem when trying to import some ACIS and IGES files

This commit is contained in:
dmv 2009-10-27 13:43:20 +00:00
parent f82f2f5a2a
commit e59444bf0e
2 changed files with 13 additions and 0 deletions

View File

@ -71,6 +71,10 @@ IGESIMPORT_EXPORT
TCollection_AsciiString& theError, TCollection_AsciiString& theError,
const TDF_Label&) 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; IGESControl_Reader aReader;
TopoDS_Shape aResShape; TopoDS_Shape aResShape;
Interface_Static::SetCVal("xstep.cascade.unit","M"); Interface_Static::SetCVal("xstep.cascade.unit","M");
@ -99,6 +103,8 @@ IGESIMPORT_EXPORT
TopoDS_Vertex V; TopoDS_Vertex V;
B.MakeVertex(V,P,1.e-7); B.MakeVertex(V,P,1.e-7);
aResShape = V; aResShape = V;
// Return previous locale before return from import
setlocale(LC_NUMERIC, aCurLocale.data());
return aResShape; return aResShape;
} }
if( theFormatName == "IGES_SCALE" ) { if( theFormatName == "IGES_SCALE" ) {
@ -149,6 +155,8 @@ IGESIMPORT_EXPORT
theError = aFail->GetMessageString(); theError = aFail->GetMessageString();
aResShape.Nullify(); aResShape.Nullify();
} }
// Return previous locale
setlocale(LC_NUMERIC, aCurLocale.data());
return aResShape; return aResShape;
} }
} }

View File

@ -74,6 +74,9 @@ STEPIMPORT_EXPORT
const TDF_Label&) const TDF_Label&)
{ {
MESSAGE("Import STEP model from file " << theFileName.ToCString()); 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; TopoDS_Shape aResShape;
//VRV: OCC 4.0 migration //VRV: OCC 4.0 migration
STEPControl_Reader aReader; STEPControl_Reader aReader;
@ -152,6 +155,8 @@ STEPIMPORT_EXPORT
theError = aFail->GetMessageString(); theError = aFail->GetMessageString();
aResShape.Nullify(); aResShape.Nullify();
} }
// Return previous locale
setlocale(LC_NUMERIC, aCurLocale.data());
return aResShape; return aResShape;
} }
} }