#!/usr/bin/perl -i.before_postproc # Author : David Sherwood # Version : 1.0 # Copyright : none. # # Slice3R GCODE laser cutter post-processor use strict; use warnings; # read stdin and any/all files passed as parameters one line at a time while (<> ) { if (/G11/) { # if we have an un-retraction line, replace it with laser power on print "M400 ; wait for moves to finish\nM104 S100 ; laser on\n"; } elsif (/G10/) { # if we found a retraction line, replace it with laser power off print "M104 S0 ; laser off\n"; } elsif (/G92/) { # if we found an extruder reset command line, remove it print ""; } elsif (/M190/) { # if we found a heat bed command line, remove it print ""; } else { print or die $!; } }