#include <StepBasic_SiUnit.hxx>
#include <StepBasic_SiUnitAndLengthUnit.hxx>
#include <StepBasic_Unit.hxx>
+#include <StepBasic_DocumentFile.hxx>
#include <STEPCAFControl_Controller.hxx>
#include <STEPCAFControl_DataMapIteratorOfDataMapOfShapePD.hxx>
#include <STEPCAFControl_DataMapOfPDExternFile.hxx>
}
}
- // get directory name of the main file
+ // get file name and directory name of the main file
OSD_Path mainfile(reader.WS()->LoadedFile());
+ TCollection_AsciiString aMainName;
+ aMainName = mainfile.Name() + mainfile.Extension();
mainfile.SetName("");
mainfile.SetExtension("");
TCollection_AsciiString dpath;
TCollection_AsciiString fullname = OSD_Path::AbsolutePath(dpath, filename);
if (fullname.Length() <= 0) fullname = filename;
+ // check for not the same file
+ TCollection_AsciiString aMainFullName = OSD_Path::AbsolutePath(dpath, aMainName);
+ if (TCollection_AsciiString::IsSameString(aMainFullName,fullname,Standard_False)) {
+ TP->AddWarning(ExtRefs.DocFile(i), "External reference file is the same main file");
+ continue; // not a valid extern ref
+ }
+
/*
char fullname[1024];
char *mainfile = reader.WS()->LoadedFile();
return Handle(StepBasic_ProductDefinition)::DownCast( myShapes(num) );
}
+//=======================================================================
+//function : DocFile
+//purpose :
+//=======================================================================
+
+Handle(StepBasic_DocumentFile) STEPConstruct_ExternRefs::DocFile(const Standard_Integer num) const
+{
+ return Handle(StepBasic_DocumentFile)::DownCast(myDocFiles.Value(num));
+}
+
//=======================================================================
//function : Format
//purpose :
//! is not associated to SDR in a proper way.
Standard_EXPORT Handle(StepBasic_ProductDefinition) ProdDef (const Standard_Integer num) const;
+ //! Returns DocumentFile to which numth extern reference
+ //! is associated.
+ //! Returns Null if cannot be detected.
+ Standard_EXPORT Handle(StepBasic_DocumentFile) DocFile (const Standard_Integer num) const;
+
//! Returns format identification string for the extern document
//! Returns Null handle if format is not defined
Standard_EXPORT Handle(TCollection_HAsciiString) Format (const Standard_Integer num) const;
--- /dev/null
+puts "=========="
+puts "0031711: Data Exchange - STEPCAFControl_Reader hangs on attached file in an infinite loop"
+puts "=========="
+puts ""
+
+# to prevent loops limit to 2 minute
+cpulimit 120
+
+set path_first [locate_data_file bug31711.stp]
+regsub -all {/} $path_first {\\} path_second
+
+ReadStep D_First $path_first
+
+XGetOneShape result D_First
+checkshape result
+checknbshapes result -solid 1 -shell 1 -face 3687 -wire 4020
+
+if { [regexp -nocase "Windows" $tcl_platform(os)] != 0 } {
+ ReadStep D_Second $path_second
+}
+
+# return cpu limit
+cpulimit 1000
\ No newline at end of file