The program flow

Here the flow of the converter program:

Check if a previous
exists, delete it.

Check if an input file
exists, if not the program will abort.

Create an output file called c:\pcb_laser\ and depending of checkbox2 (9600 baud / no LCD) put G-code M117 Laser active in it. The cheap Banggood laser engraver stops on the M117 commands, so we have to skip it. If checkbox1 checked put the G-c0de G28 X0 Y0 Z0 in the file. Banggood laser engraver has no Z-axis. Speed G-code is placed.

Replace all lines starting with ; % # M G36 G21 G90 with a line starting with a T

Replace all G01 Z-3.80 with a letter B. This is the actual drill hole.
Replace all G00 Z03.80 with a letter T
Replace all G01 Z-2.00 (start milling) with a letter T
Replace all G00 Z02.00 with a letter T

While going through the file find the maximum and minimum X and Y and put them in a few variables.

Place some lines as footer in the file
M05 for laser OFF
G0 F <speed move with laser OFF> X0 Y0

Place the Offset X and Offset Y on the screen

Take care of the extra offsets that might be given in the GUI.

Pre-scan done
Now put the offsets at work…
Put the speeds in the commands
Put the laser code in the commands

All variables are fetched from the GUI. Speed moving laser off, speed moving laser on, distance Z-axis, should Z-code be generated. When you just finished a laser job you can skip this to speed up the process.

Create a final output file pcb_laser_output

Do you find a B in the file, then that is a Drill command. G04 P100 delay-command. Is the laser on, output a G04 P1 delay (no delay).

Put a M117 CenterPoint message in the output file

Place 8 laser point G-code commands around this centerpoint

Put on the GUI that file exists and how many lines it has.

Disable the convert button
Enable the send to laser button


While sending of the output file, a progress bar appears.

At G-code M03 (laser ON) and M05 (laser OFF) a laser-status bit is set or reset. Is the Quit button pressed a confirm screen is shown. Laser is turned off. Is the Quit not confirmed then the laser is put on or off depending of the laser-status variable, and the job is continued.

During the different phases of the conversion, you can check the input and output files with GRBL-controller.

Visual Basic 2015 or 2017

It is what it is, free, fully-featured IDE for students, open-source and individual developers.

The files in the project.

Here a part of the user interface. The default values are:
Moving, laser off, speed 3600.
Moving, laser on, speed 1000.
Laser height at 32 mm above the PCB.
Generate Z-code. If you turn this on G-code will be generated to bring the Z-axis to zero and after that go to the 32 mm above the PCB. If you know your last laser project was PCB lasering, you can skip the Z-code generation, it will all be faster at start-up.
Offset X and Offset Y. If you want to laser more than one board you can shift the 0,0 origin.
Comm-port is the virtual port to use to communicate with the laser engraver. The baud-rate is fixed at 250000 or 115200, you will have to adapt that in the source code.
And the last option is for the Banggood (CE – Chinese Electronics ­čśë ) laser engraver. It will skip messages M117 to the LCD-display and put the baud-rate on 9600.

There are 3 buttons, Convert, Send to laser and Quit. You can use GRBL controller software to check the input file, and after a convert, check the output file. When you hit Quit by mistake, not to worry, a confirm box will be displayed. And as an extra, the laser will be turned off when it was turned on, and after hitting NO in the confirm box lasering will continue without any problem, the software has remembered the status of the laser.

In the user interface a check if an input file exist. If it doesn’t exist, the Convert button will keep grayed-out. is the name used while exporting a milling-file from Eagle. A pre-scan file is created but also deleted after use. It is called It is used to do some work ahead and also check the dimension of the PCB laser file (offset X as mentioned in earlier posts).

In the user interface a note about the output file and also the number of G-code lines. This will later be used to check to progress of lasering the board. Convert button will be grayed-out and the Send to laser will be enabled.