What sort of Gcode options are there?

I have a LionsForge Craft Laser from Singapore which is a bit unconventional, but overall I am pleased with it. However, problems with the recommended software (Inkscape), forced me to seek an alternative and I am very happy with LightBurn.

Basically it takes Gcode on an SD card and runs that. There is no software ( Gcode ) power settings, that is done by an external knob. The speed is controlled by an overall speed setting as a multiplier from 50% to 500%, the manufacturers say there is no software speed control, but thanks to your software I have found out there is.

When it came to choosing a Laser cutter I thought it didn’t matter which I chose because I was not going to use it, but I found that the laser you chose affects the sort of Gcode that is produced. There is no mention of this either on line or in the LightBurn manual so I had to resort to trial and error.
I first tried GRBL but that produced very wired results on my laser. On examining the code I found that in a sequence of moves there was only one G1 code being sent, with subsequent vectors being just the X & Y values. In the world of MIDI music message protocols this is known as a running status, I am not sure of the name of it in the Gcode world.

Then I tried LinuxCNC and found that this adds a speed of zero to all the G0 move commands.

The one I found that finally worked (so far in testing) was the smoothieware driver. This did not set a feed rate for the G0 moves but putting a custom G0 F3000 in the Gcode Tab of the Device settings solved that.

I had to change the display units to mm/min and set the speed to 300 on all layers to complete the setup for my laser.

Now the point is that none of these things were mentioned in the manual and I had to work it out myself. Are there other Gcode variants in the other laser drivers and are they customisable?
For example Lasers that generate Gcode circle commands instead of breaking it up into straight line segments, and maybe other things I have not thought of?

So I have been trying all the predefined machines to see what sort of G code they produce when asked to draw a hexagon and a circle.

All machines except Fab kit and Smoothieware produce just 6 points when drawing a hexagon. The two exceptions produce lots of small steps causing deeper cuts.

Linux CNC, Marlin and snap maker all produce Go commands with a feed rate of 0

All machines use lots of small steps for drawing a circle. So none of them use G2 or G3 to define them.

I can’t see any difference, as yet, between the Can Cam & the various flavors of Gerbil.

Yes, laser manufacturers are a dime a dozen, especially with diode machines. They have been known to alter firmware to their own desire, yes, making things weird. LightBurn can talk to several versions of GRBL, but it needs to be close to the stock build.

We do not at this time support any arc commands. All arcs are approximated with lines and there’s a “Curve Tolerance” setting in Settings > File Settings that can be tweaked if you want to smooth things out at the cost of more/smaller line segments.

We also do not currently have a customizable gcode profile - though it’s on our list of things to add.

If your controller doesn’t “speak” the gcode language of one of the existing gcode device types then LightBurn will not currently be able to control it. Though, we are not familiar with LionsForge so could not tell you what variant it uses - though from what you’ve described it seems very much custom.

1 Like

Thanks for clearing things up with those comments.

I can control my Laser fine with Light Burn but I was puzzled as to how it produced hexagons, of which my first project with Light Burn has rather a lot. So rather than go with the Smoothieware as the basis I will go with the CanCam version.

I probably wont answer any questions here, but I can at least give some background to what you are seeing and why its a thing to some of your observations below.

In the GCode world we call this Modal. A G1 moves (feed move, with lasers its usually also a “Laser On” move) speed is often modal meaning its consistent until changed. This is a hold over the time when CNC machines were programmed by hand standing at a machine.

G0 moves are “rapid moves” meaning they are done at full machine travel speed. This is why there is no speed set, or its set to zero.

Its interesting you had to add that. Do you have a sample of the code that the inkscape plugin produces? I am more curious than anything. Regardless I am glad you found a work around.

I am not sure what you mean here. Which speed? are you etching everything? Why all layers?

Adam and ray covered this one mostly. It is heavily dependent on what your manufacturer is expecting. This kind of customization is not the norm, and no one on the team has heard of this laser so its not shocking that nothing just “worked” out of the box, but is also why its not documented in the docs.

Good job working your way through it though! That was a journey and you did exactly what we would have done while trying to figure out how to work it.

1 Like

GRBL-M3 is the simplest profile we have - it uses G0 and G1 moves only, with M3 to turn on the laser and M5 to turn it off. G1 moves will include a feed rate (F) and spindle power (S) parameter to vary the movement speed and power when those values need to change, and otherwise they’re just “remembered” by the controller (modal, as Joe pointed out).

The GRBL profile uses M4 by default to enable the laser, and this means “vary the power as the movement speed varies”, which produces cleaner vector marking because the power is reduced when the machine slows down for sharp corners.

These and the other profiles, like Smoothieware, Marlin, etc, all know the specifics of what GCode format those controllers need, what size the receive buffer of the hardware is, what baud rate they use for communication, any required settings for the USB connection, and it knows special commands for things like test firing the laser, setting firmware parameters, and so on. Since LightBurn is much more than just a GCode generator we need to know these things, and we’ve initially restricted how much can be user edited to prevent errors.

We do have a plan to make a generic GCode profile that doesn’t control the machine, but will let you edit the output GCode format, but work on that has not started yet.

Thanks for all that very informative. Just to say at the outset that I am very pleased with LightBurn and I have bought a license.

Inkscape uses third party plugins to generate Gcode and the makers of my laser recommend using this one:-
Which comes from the 3D printing world. The problem is that when Inkscape moved to version 1.0 it changed the way plugins worked and this one no longer worked. Still I could keep to the old Inkscape version until an update to X11 scuppered that. After two years version 1.x of Inkscape still did not have a working Gcode generator and some one on the Inkscape forum recommended LightBurn. I was previously aware of it from early research into the Emblaser Diode laser. LightBurn is so easy to use compared to Inkscape it is a joy to use.

Gcode for cutting one hexagon

M3 S255

G0 F3000
G0 X297.4315 Y106.059

G1 F300.000000
G1 X295.2335 Y46.029
G1 X242.2902 Y17.9228
G1 X191.5449 Y49.8466
G1 X193.7428 Y109.8765
G1 X246.6862 Y137.9827
G1 X297.4315 Y106.059
G0 F3000
M5 S0
G0 X0 Y0

The M452 I think is something to do with turning on an extruder (3D printing), but my laser just ignores any Gcode it cant cope with like any of the M commands.
It will also use G2 & G3 codes for doing curves, so my laser supports these.

OK but to me zero means don’t move and it meant that to my laser as well. The Inkscape plugin had a box to enter maximum travel speed.

The speed in each layer box, the setup comments that mm/min is best for a diode laser, but mine is a CO2, once I changed the units I could make them the same as the plugin.
As to all the layers:-
My laser works with a knob for the power and a speed multiplier for the exact speed. Therefore if I want to engrave something and then cut something out this would involve me generating two Gcode files, three if I wanted a rastered image as well. In Inkscape I would draw a master drawing with everything on it, then separate it a number of sub drawings for each aspect and then generate the Gcode. This involved copying the master drawing and deleting everything that I didn’t want in that Gcode file.

With LightBurn if I put every separate element on a different layer then it is easy to generate the Gcode for separate elements and everything lines up. In addition I am in the UK in a domestic environment and when it is hot (yes it does get hot here sometimes) the laser can get too hot. It is simple to break up layers with a lot of cutting into three or more separate Gcode files in order to give my laser a cooling break in between.
I mainly make enclosures for my electronic projects and this involves drawing a top and base connected by brass pillars. The basic outline is the same but the top would involve holes for controls like potentiometers . It is convenient to also have a keep out area to stop you placing things too close. Again this keep out region can be accommodated on a different layer but it never makes it to a Gcode file.

That’s fair enough.

Thanks, that was my main reason for posting, to help others facing the same problem. I did see one other person with the same laser as I had on a forum say he had switched to LightBurn, but I didn’t see anything about it on this forum, so I thought I would document my experiences.

M452 is “Laser Mode” in RepRapFirmware and Repetier. If you are ever curious about codes this is a great reference: G-code - RepRap

Thanks for documenting. It looks like a well built machine, just has some quarks that need to be worked through.

Based on the code you posted, the GRBL-M3 profile should do what you need. It uses G0 / G1 for rapid / feed moves, and M3 / M5 to turn on / off the laser, which is exactly what your code shows. If you added a G0 F3000, like you did for Smoothieware, it would work, and the S parameter is automatically set to a range of 0 to 255, though it sounds like your system doesn’t use that anyway.

Given that you’re just using it to save GCode, it probably doesn’t matter which device profile you use, and if Smoothieware is working for you, I don’t see much need to change it.

Thanks for that, lots of food for thought.

I did try the GRBL-M3 profile and while it did work the G0 speed was slow, at a guess the rate looked more like 300 rather than the 3000 I had set. I did add G0 F3000, followed by an G1 F300. When I removed the F300, it set off at the normal speed, but after that all the movement between cuts, and the return home were at the slower speed. It is as if any parameter it got for a feed rate was applied persistently to both G0 and G1 calls in the absence of anything else.

I got a bit more information about my laser, in that it uses one of these boards in it.
Now I don’t know what sort of software the makers put into it, but I am assuming it was not far from a Marlin standard software. So I looked at this profile again. This produces code that includes a F0 setting in every G0 command, and as such, will not work directly. However, when I used a text editor to do a global find and replace, to change every F0 into an F3000, then my laser behaved normally. I conclude that a Marlin does not use the convention that F0 defaults to the fastest the machine will go, but requires a feed rate to use. This extra step seems worth it to get the faster movement between cuts, and it is not too onerous. I might even come up with a script to do it but it hardly seems worth it.
So I will be using this setup and see how this goes.

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