tbfleming / jscut

In-browser CAM package
http://jscut.org
GNU General Public License v3.0
295 stars 136 forks source link

Jscut generating 2 identical cut paths on lowest layer #41

Closed andrewhodel closed 8 years ago

andrewhodel commented 9 years ago

Steps to reproduce issue

tocut.svg - http://pastebin.ca/3018586

tocut.gcode - http://pastebin.ca/3018587 (line 780 it goes to Z-12 and cuts, then on line 1157 it again repeats the same process)

This results, especially when cutting sheets, in the object being cut free from the sheet and then the tool making another pass on the same path at the same depth. Unless you are standing there holding the cut out part in place it will ruin the cut.

tbfleming commented 9 years ago

Please use "Save Settings" -> Gist to make reproduction easier.

andrewhodel commented 9 years ago

https://gist.github.com/anonymous/44f0874b86bdbb47519c

tbfleming commented 9 years ago

It's a rounding bug; it creates a path at Z=-11.99999... then at Z=-12. The rounding code generates -12.0000 for both values. Workaround for this case: change Pass Depth to 4.01.

andrewhodel commented 9 years ago

Can you give me the point in the source where this is calculated?

tbfleming commented 9 years ago

https://github.com/tbfleming/jscut/blob/gh-pages/js/Cam.js#L409 https://github.com/tbfleming/jscut/blob/gh-pages/js/Cam.js#L463 https://github.com/tbfleming/jscut/blob/gh-pages/js/Cam.js#L474