Laser engraving

Last Updated or created 2022-05-30

Bought a laser engraving kit, which can be mounted on my 3D Creality Printer, using magnets.

I’ve connected the power to a fan connector in 3D printer. So it can be controlled with gcode’s

M18 Z; stop Z axes, use only X and Y
M106 ; laser on command
M107 ; laser stop command

I’ve created a bash script which outlines our design with minimal and maximal x and y coordinates, so you can allign your object just in the right place.
It uses a low voltage on you laser, so its visible but it doesn’t burn you object.

#!/bin/bash
myz=100
MAXX=$(cat "$1" | grep "G0 X" | awk '{ print $2 }' | cut -c2- | sort -n | tail -1)
MINX=$(cat "$1" | grep "G0 X" | awk '{ print $2 }' | cut -c2- | sort -n | head -1)
MAXY=$(cat "$1" | grep "G0 X" | awk '{ print $3 }' | cut -c2- | sort -n | tail -1)
MINY=$(cat "$1" | grep "G0 X" | awk '{ print $3 }' | cut -c2- | sort -n | head -1)

cat > "pointtest - $1" << EOF
;BingoStart
G90
M17 Z
G0 F3000
G0 $myz F3000
M18 Z
G0 X${MINX} Y${MINY}
M106 S2
G0 F3000
G0 X${MINX} Y${MAXY}
M106 S2
G0 F3000
G0 X${MAXX} Y${MAXY}
M106 S2
G0 F3000
G0 X${MAXX} Y${MINY}
M106 S2
G0 F3000
G0 X${MINX} Y${MINY}
M106 S2
G0 F3000
G0 X${MINX} Y${MAXY}
M106 S2
G0 F3000
G0 X${MAXX} Y${MAXY}
M106 S2
G0 F3000
G0 X${MAXX} Y${MINY}
M106 S2
G0 F3000
G0 X${MINX} Y${MINY}
M106 S2
M107
;end
EOF

Below a offset fixer

#!/bin/bash
myz=100
cat "$1" | sed s/Z1/Z${myz}/g | sed s/Z6/Z${myz}/g > "fixed.$1"

Internals of my Creality 3D Printer .. using fan controller to power/control engraving laser