Output information about failure during reading of external file has been added (it can be checked by using Draw command "tpstat").
If the reader cannot find an external file at the first found location
(using entity APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT) it checks other information about file path
(using entity DOCUMENT_FILE related with the above-mentioned entity) and uses a new location for import of the external file.
#include <StepShape_ShapeRepresentation.hxx>
#include <TCollection_HAsciiString.hxx>
#include <XSControl_WorkSession.hxx>
+#include <XSControl_TransferReader.hxx>
+#include <OSD_File.hxx>
+#include <OSD_Path.hxx>
//=======================================================================
//function : STEPConstruct_ExternRefs
}
}
}
- if ( ! aCStringFileName || ! aCStringFileName[0] ) {
- // try to find name direct from DocFile
+ Standard_CString oldFileName = 0;
+ // compute true path to the extern file
+ OSD_Path mainfile(WS()->LoadedFile());
+ mainfile.SetName("");
+ mainfile.SetExtension("");
+ TCollection_AsciiString dpath;
+ mainfile.SystemName(dpath);
+ if (aCStringFileName && aCStringFileName[0]) {
+ TCollection_AsciiString fullname = OSD_Path::AbsolutePath(dpath, aCStringFileName);
+ if (fullname.Length() <= 0) fullname = aCStringFileName;
+ if (!OSD_File(fullname).Exists()) {
+ oldFileName = aCStringFileName;
+ aCStringFileName = 0;
+ }
+ }
+ if (!aCStringFileName || !aCStringFileName[0]) {
+ // try to find name of the directory from DocFile
if ( !DocFile.IsNull() ) {
Handle(TCollection_HAsciiString) aFilename = DocFile->Id();
if (!aFilename.IsNull() && !aFilename->IsEmpty())
aCStringFileName = aFilename->ToCString();
}
if ( ! aCStringFileName || ! aCStringFileName[0] ) {
- return "";
+ if (oldFileName) {
+ aCStringFileName = oldFileName;
+ }
+ else {
+ return "";
+ }
}
- else
- return aCStringFileName;
+ }
+ }
+ TCollection_AsciiString fullname = OSD_Path::AbsolutePath(dpath, aCStringFileName);
+ if (fullname.Length() <= 0) fullname = aCStringFileName;
+ if (!OSD_File(fullname).Exists()) {
+ if (oldFileName) {
+ aCStringFileName = oldFileName;
+ }
+ Handle(Transfer_TransientProcess) aTP = WS()->TransferReader()->TransientProcess();
+ TCollection_AsciiString aMess("Can not read external file ");
+ aMess.AssignCat(aCStringFileName);
+ aTP->AddFail(DocFile, aMess.ToCString());
+ }
+ else {
+ if (oldFileName && strcmp(oldFileName, aCStringFileName) != 0) {
+ Handle(Transfer_TransientProcess) aTP = WS()->TransferReader()->TransientProcess();
+ TCollection_AsciiString aMess("External file with name from entity AEIA (");
+ aMess.AssignCat(oldFileName);
+ aMess.AssignCat(") not existed => use file name from DocumentFile entity - ");
+ aMess.AssignCat(aCStringFileName);
+ aTP->AddWarning(DocFile, aMess.ToCString());
}
}
return aCStringFileName;
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 5 ) Warnings = 0 ( 0 ) Summary = 0 ( 5 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 5 ) Warnings = 0 ( 0 ) Summary = 0 ( 5 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )
set ref_data {
DATA : Faulties = 0 ( 7 ) Warnings = 0 ( 0 ) Summary = 0 ( 7 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 7 ) Warnings = 0 ( 0 ) Summary = 0 ( 7 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 11 ) Warnings = 0 ( 0 ) Summary = 0 ( 11 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 8 ) Warnings = 0 ( 0 ) Summary = 0 ( 8 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 9 ) Warnings = 0 ( 0 ) Summary = 0 ( 9 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 8 ) Warnings = 0 ( 0 ) Summary = 0 ( 8 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )
set ref_data {
DATA : Faulties = 0 ( 9 ) Warnings = 0 ( 0 ) Summary = 0 ( 9 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
+TPSTAT : Faulties = 0 ( 9 ) Warnings = 0 ( 0 ) Summary = 0 ( 9 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )
set ref_data {
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
-TPSTAT : Faulties = 0 ( 0 ) Warnings = 0 ( 28 ) Summary = 0 ( 28 )
+TPSTAT : Faulties = 0 ( 8 ) Warnings = 0 ( 28 ) Summary = 0 ( 36 )
CHECKSHAPE : Wires = 0 ( 0 ) Faces = 0 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
NBSHAPES : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 )
STATSHAPE : Solid = 0 ( 0 ) Shell = 0 ( 0 ) Face = 0 ( 0 ) FreeWire = 0 ( 0 )