Actions Status

NAME

GcodeXY - Produce gcode files for pen plotters from Perl

SYNOPSIS

use Graphics::Penplotters::GcodeXY;
# create a new GcodeXY object
$g = new Graphics::Penplotters::GcodeXY( papersize => "A4", units => "in");
# draw some lines and other shapes
$g->line(1,1, 1,4);
$g->box(1.5,1, 2,3.5);
$g->polygon(1,1, 1,2, 2,2, 2,1, 1,1);
# write the output to a file
$g->output("file.gcode");

DESCRIPTION

GcodeXY provides a method for generating gcode for pen plotters (hence the XY) from Perl. It has graphics primitives that allow arcs, lines, polygons, and rectangles to be drawn as line segments. Units used can be specified ("mm" or "in" or "pt"). The default unit is an inch, which is used internally. Other units are scaled accordingly. The only gcode commands generated are G00 and G01. Fonts are supported, SVG input is possible, and Postscript output can be generated as well.

DEPENDENCIES

This module requires Math::Bezier, and Math::Trig. For SVG import you will need Image::SVG::Transform and XML::Parser and Image::SVG::Path and POSIX and List::Util and Font::FreeType.

CONSTRUCTOR

OBJECT METHODS

Unless otherwise specified, object methods return 1 for success or 0 in some error condition (e.g. insufficient arguments).

BUGS AND LIMITATIONS

As noted above, the SVG specification (900 pages) is only partially implemented, and just one layer can be used. I suspect that diagnostics about pen travel distance may not always be correct. Clipping is not supported. Layering is not supported officially, but can be simulated.

AUTHOR

Albert Koelmans (albert.koelmans@googlemail.com).

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.