Introduction
Paper, Pen, Path, Point
Peqoud is a Lua libary for generating drawings for pen plotters.
Pequod aims to be easy to use with a readable source.
Tested with Lua 5.1, and Luajit.
Install
Single file install: Download pequod.lua and place it in the same directory as your lua file.
Luarocks install: In progress.
Example drawing
A simple example of a Pequod drawing. first_drawing.lua.
-- Load the Pequod Lua Rock.
require("pequod")
-- Create a peice of paper to draw on.
-- Give it a width of 120mm and a height of 90mm.
local my_paper = Paper({ width = 120, height = 90 })
-- Create a pen to draw with.
-- Set it to draw on our peice of paper.
-- Give it a width of 2mm, and set the color to black
local black_pen = Pen({ paper = paper, weight = 2, color = 'black'})
-- Create a path to draw.
local my_path = Path()
-- Add some points to the path.
my_path:add_points({
Point(35, 70),
Point(85, 70),
Point(85, 20),
Point(35, 20)
})
-- Close the path.
my_path:close()
-- Draw the path with our black pen.
my_path:draw_with(black_pen)
-- Save SVG and HPGL files for your drawing .
my_paper:save_svg("my_first_example.svg")
my_paper:save_hpgl("my_first_example.hpgl")