| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | # template for GcodeXY project | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | use Graphics::Penplotter::GcodeXY; | ||
| 8 | |||
| 9 | # create a gcode object | ||
| 10 | # shows all keys with its defaults | ||
| 11 | my $g = new Graphics::Penplotter::GcodeXY( | ||
| 12 | header => "G20\nG90\nG17\nF 20\nG92 X 0 Y 0 Z 0\nG00 Z 0\n", # must end with penupcmd | ||
| 13 | trailer => "G00 Z 0\nG00 X 0 Y 0\n", # return to origin | ||
| 14 | penupcmd => "G00 Z 0\n", # usually plotter independent | ||
| 15 | pendowncmd => "G00 Z 0.2\n", # plotter dependent | ||
| 16 | papersize => undef, # paper size e.g. "A3" | ||
| 17 | xsize => undef, # bounding box x | ||
| 18 | ysize => undef, # bounding box y | ||
| 19 | units => 'in', # inches is used internally | ||
| 20 | feedrate => 20, # write speed | ||
| 21 | margin => 1.0, # margin as a PERCENTAGE | ||
| 22 | outfile => '', # gcode output file name | ||
| 23 | curvepts => 50, # line segments per curve | ||
| 24 | check => 0, # print stats and advice | ||
| 25 | warn => 0, # out of page bounds warning | ||
| 26 | hatchsep => 0.012, # inches, equivalent to 0.3 mm (the tip of a BIC ballpoint pen) | ||
| 27 | id => '', # useful for debugging, esp. when using multiple objects | ||
| 28 | optimize => 1, # peephole optimizer is on by default | ||
| 29 | ); | ||
| 30 | |||
| 31 | # your code goes here | ||
| 32 | |||
| 33 | |||
| 34 | $g->output("file.gcode"); | ||
| 35 |