Missing spaces in gcode (e,g,G1X60.146)

I am trying out LightBurn for running a laser etcher attached to the head of a 3D printer (sending the gcode to the printer using the OctoPrint interface). I have set up a simple square to have an initial look. When I save the gcode for this I get some errors:
Most important the gcode has several G1 commands that do not put a space between the command and the parameter (I think only X positions):
; Cut @ 6000 mm/min, 20% power
M106 S0
G0X20.547 Y50.299 F0
; Layer C00
M106 S51
G1 Y79.445 F6000
G1 Y50.299

The Q&D fix seems to be to open the file in a text editor and replace all G0X with G0 X; is there abetter fix within LightBurn, or can this be fixed in the next update?

Less of a problem (at present) are two errors which the printer whinges about but then seems to carry on. The first is blank lines which appear before and after User Start Scripts; the second is M8 and M9 commands not recognised by my set up. Again fixable with a text editor but I would prefer not to have to resort to this if possible.
Thanks for any advice.

There’s no provision within LightBurn that would allow a simple user initiated fix.

Frankly, the right thing to do is probably to open a bug report with the OctoPrint team and ask them to correct the implementation to allow for both since the syntax out of LightBurn is valid.

Alternatlvely, I’m not too familiar with OctoPrint but is there any pre-processor option that could be run before each job, either as regex within OctoPrint itself or an external process? If so, a simple script to parse and replace every instance with the needed spacing would be trivial.

The other two issues you list could be handled the same way. Don’t understand the specifics of why they’re not accepted so don’t know if they’d likely be accepted as defects for those.

Hi - Shouldn’t really make any difference if there are spaces or not with a good Gcode parser. G0 X20 should behave exactly same as G0X20. Spaces simply make it easier to read for humans. Unfortunately some interpretations of Gcode insist on spaces due to the way the source code is written. Using the free Notepad++ (not windows notepad) it’s easy to write a script to automatically do this for you. Would be pretty tedious manually on a large file.

Thanks for the replies. I hadn’t appreciated that gcode doesn’t require the spaces! Having dug a little deeper, this does seem to be the case. The problem is thus with the parser so I will look more deeply into that end of the process. In the meanwhile I will add fixing the gcode to be compliant with the printer to my workflow!

1 Like

Let us know what you find out or where you end up with this as there are others here that I know would be interested in this. The gcode spacing has been brought up before.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.