+ IGESIMPORT_EXPORT
+ Handle(TCollection_HAsciiString) GetValue (const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& theParameterName,
+ TCollection_AsciiString& theError)
+ {
+ Handle(TCollection_HAsciiString) aValue;
+
+ if (theParameterName != "LEN_UNITS") {
+ theError = theParameterName + " parameter reading is not supported by IGES plugin";
+ return aValue;
+ }
+
+ // Set "C" numeric locale to save numbers correctly
+ Kernel_Utils::Localizer loc;
+
+ IGESControl_Reader aReader;
+
+ Interface_Static::SetCVal("xstep.cascade.unit","M");
+
+ try {
+ OCC_CATCH_SIGNALS;
+
+ IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
+ if (status == IFSelect_RetDone) {
+ Handle(IGESData_IGESModel) aModel =
+ Handle(IGESData_IGESModel)::DownCast(aReader.Model());
+ if (!aModel.IsNull()) {
+ aValue = aModel->GlobalSection().UnitName();
+
+ //if (!aValue.IsNull()) {
+ // Handle(TCollection_HAsciiString) aPrefix = new TCollection_HAsciiString ("UNIT_");
+ // aValue->Prepend(aPrefix);
+ //}
+ }
+ }
+ else {
+ theError = theFileName + " reading failed";
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ theError = aFail->GetMessageString();
+ }
+
+ return aValue;
+ }
+