MaskedRetriever / SuperSkein

Open Source 3D Mesh Slicer in Processing: Generates gcode from stl files.
http://www.thingiverse.com/thing:3649
GNU General Public License v3.0
70 stars 11 forks source link

STL Load Progress Bar is Weak #6

Open MaskedRetriever opened 14 years ago

MaskedRetriever commented 14 years ago

Threading the STL load is a great idea in that the applet starts up right away, even with big meshes. However the STL loading operation doesn't really support giving the user a clear idea of how long this is taking at the moment. For now I'm going to add a message to the progress bar to the effect of "this may take a while".

Not ideal, obviously.

revarbat commented 14 years ago

Easy solution: at the start of STL file load, get the file size, then keep track of how many bytes you've read of the file, then fill in the progress bar based on what percentage of the file you've read in bytes.

File file = new File("filename.stl"); long length = file.length();

MaskedRetriever commented 14 years ago

Hm, I think when I wrote this I was convinced generating the file pointer actually loaded the whole file. Hoping I was wrong....

MaskedRetriever commented 14 years ago

Oh wait, here it is: byte b[] = loadBytes(FileName);

This does the entire file load as one operation (in terms of Processing at least) meaning I'll have to break it up somehow if I want the speedup... And it happens in the Mesh Constructor. :P