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

Visualizer not functioning in relative mode #2501

Open ehouais opened 6 months ago

ehouais commented 6 months ago

Version

2.1.6

Hardware / Firmware

GRBL 1.1

What happened

When plotting a GCode program in relative mode (G91), nothing is shown in the visualizer, though the program is valid and successfully plotted on my iDraw A3. When I switch to absolute coordinates using the code G90, the visualizer shows the path as it should.

How to reproduce

Simple example program in relative mode that is not visualized properly:

G92 X0 Y0
G90
G1 F10000 Z0.5
G91 
G1 X50 Y-50
G1 F5000 Z4.5
G1 F2000
G1 X-10 Y0
G1 X0 Y10
G1 X10 Y0
G1 X0 Y-10
G1 F10000 Z-4.5
G1 F8000
G1 X-50 Y50

Equivalent program in absolute mode that is visualized properly

G92 X0 Y0
G90
G1 F10000 Z0.5
G1 X50 Y-50
G1 F5000 Z4.5
G1 F2000
G1 X40 Y-50
G1 X40 Y-40
G1 X50 Y-40
G1 X50 Y-50
G1 F10000 Z-4.5
G1 F8000
G1 X0 Y0

Operating System

Mac mini M2 with macOS Sonoma

Anything else

No response

breiler commented 6 months ago

How did you generate this program?

ehouais commented 6 months ago

Home-made generation pipeline. I find relative moves more suitable to my algorithmic experiments.

breiler commented 6 months ago

I found a problem that the visualizer needs to know the first point in order for it to work with relative coordinates. This should normally be the current work position but is not used when loading the model.

The quickest workaround is to add one absolute movement in the beginning of the program:

G21
G92 X0 Y0 
G90 G0 X0 Y0 ; workaround to set the initial point
G1 F10000 Z0.5
G91 
G1 X50 Y-50
G1 F5000 Z4.5
G1 F2000
G1 X-10 Y0
G1 X0 Y10
G1 X10 Y0
G1 X0 Y-10
G1 F10000 Z-4.5
G1 F8000
G1 X-50 Y50
ehouais commented 6 months ago

OK, tested it and it works now. Thanks for your quick response !