Archived issue #0027561
Data Exchange - since OCCT 7.0.0, exporting a curve to STL creates a file that results in an endless loop when read
Description
In 7.0.0, when a curve is exported to STL a file is created that seems to contain only header information. When this file is read, it results in an endless loop.
In 6.9.0, when a curve is exported to STL no file is created! Instead, Draw shows an error message: "** Error **: Mesh is empty. Please, compute triangulation before."
Surely, curves cannot be represented in STL files, but in any case if such files are read it should not result in an endless loop.
The endless loop occurs in RWStl::ReadAscii in the following code:
while (getc(file) != '\n');
In 6.9.0, when a curve is exported to STL no file is created! Instead, Draw shows an error message: "** Error **: Mesh is empty. Please, compute triangulation before."
Surely, curves cannot be represented in STL files, but in any case if such files are read it should not result in an endless loop.
The endless loop occurs in RWStl::ReadAscii in the following code:
while (getc(file) != '\n');
Steps to reproduce
pload XDE restore Attachment 1 (BREP) c whatis c writestl c curve.stl readstl c2 curve.stl
Public activity
5 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Participant.
[revision removed]
Detailed log of new commits:
Author: abv
Date: Tue Aug 15 17:58:53 2017 +0300
0027561: Since OCCT 7.0.0, exporting a curve to STL creates a file that results in an endless loop when read
Add check for empty triangulation when writing STL file to report error instead of creation of empty file.
Test added for that: bugs stlvrml bug27561
STL reader has been improved to properly handle case of empty or small files, and Ascii files without EOL at the end.
Test added for that: de_mesh stl_read D1
[revision removed]
Detailed log of new commits:
Author: abv
Date: Tue Aug 15 17:58:53 2017 +0300
0027561: Since OCCT 7.0.0, exporting a curve to STL creates a file that results in an endless loop when read
Add check for empty triangulation when writing STL file to report error instead of creation of empty file.
Test added for that: bugs stlvrml bug27561
STL reader has been improved to properly handle case of empty or small files, and Ascii files without EOL at the end.
Test added for that: de_mesh stl_read D1
Endless loop does not occur any more when reading empty STL files; apparently this has been fixed by changes made within #0028840.
I have pushed correction for writer to fail in case of empty triangulation (instead of writing empty file), and for reader to treat properly case of empty or small STL files. Please review: branch CR27561.
The tests have passed, see Jenkins job CR27561-master-abv.
I have pushed correction for writer to fail in case of empty triangulation (instead of writing empty file), and for reader to treat properly case of empty or small STL files. Please review: branch CR27561.
The tests have passed, see Jenkins job CR27561-master-abv.
Please take the patch.
Combination -
OCCT branch : [archived branch] - [revision removed]
Products branch : [archived branch]
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode.
Number of compiler warnings:
OCCT :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)
Products :
Linux: 5 (5 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Windows:
OCCT
Total CPU difference: 17330.010689098726 / 17295.75286949859 [+0.20%]
Producst
Total CPU difference: 7688.758886599963 / 7720.302288799964 [-0.41%]
Linux:
OCCT
Total CPU difference: 19451.89000000023 / 19456.560000000376 [-0.02%]
Products
Total CPU difference: 7703.40000000009 / 7725.120000000072 [-0.28%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
OCCT branch : [archived branch] - [revision removed]
Products branch : [archived branch]
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode.
Number of compiler warnings:
OCCT :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)
Products :
Linux: 5 (5 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Windows:
OCCT
Total CPU difference: 17330.010689098726 / 17295.75286949859 [+0.20%]
Producst
Total CPU difference: 7688.758886599963 / 7720.302288799964 [-0.41%]
Linux:
OCCT
Total CPU difference: 19451.89000000023 / 19456.560000000376 [-0.02%]
Products
Total CPU difference: 7703.40000000009 / 7725.120000000072 [-0.28%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
Branch [archived branch] has been deleted by Commenter 4.
[revision removed]
[revision removed]
Related records