winder / Universal-G-Code-Sender

A cross-platform G-Code sender for GRBL, Smoothieware, TinyG and G2core.
http://winder.github.io/ugs_website/
GNU General Public License v3.0
1.89k stars 764 forks source link

Fix for not assuming that origin position is 0,0,0 #2423

Closed breiler closed 8 months ago

breiler commented 8 months ago

This fix will make UGS use the current work position as the starting point and use it for rendering the gcode in in the visualizer.

Consider this GCode, it has no Z coordinate defined but is yet rendered with the center at Z0 without this fix.

G17 G20 G90 G94 G54 M0 M5 M9
G0 X-0.5 Y0. F5
G2 X0. Y-0.5 I0.5 J0.
G2 X-0.5 Y0. I0. J0.5

If I were to run this when the Z-position was not zero, what is visualized is not what I get: image

With these changes it will now properly visualize what is going to happen when running this gcode program: image

Also fixes some of the problems in the autoleveler discussed in #1583