Skip to content
/ plotter Public

All the needed software to print images, text or gcode files on a plotter (a pen that moves along two xy axes)

Notifications You must be signed in to change notification settings

Stypox/plotter

Repository files navigation

Plotter software

This repository contains all of the code needed to run a plotter and have it print G-code, text or images. In particular:

  • the plotter/ subdirectory contains the Arduino sketch
  • the gcode_parser.py script is able to read G-code, normalize it (so that the printed composition fits on a 2D rectangle of a specified size) and convert it to a shorter binary file
  • the sender.py script takes the binary file generated by gcode_parser.py and sends it to a plotter connected to the computer via a serial port
  • the print.py script wraps all of the things you may need into a single command
  • text-to-gcode is used to convert some ASCII text to G-code
  • image-to-gcode is used to convert an image to G-code, also with automatic edge detection

Usage

You can run any script normally with Python 3. E.g. for print.py:

python3 print.py ARGUMENTS...

This is the help screen with all valid arguments for print.py (obtainable with python3 print.py --help):

usage: print.py [-h] [-o FILE] [-b FILE] [-l FILE] [--end-home] [-s XxY] [-d FACTOR] [--simulate] [--port PORT] [--baud RATE] {binary,gcode,text} ...

Print something with the connected plotter

optional arguments:
  -h, --help            show this help message and exit

subcommands:
  Format subcommands

  {binary,gcode,text}
    binary              Send binary files directly to the plotter
    gcode               Print gcode with the plotter
    text                Print text with the plotter

Output options:
  -o FILE, --output FILE
                        File in which to save the generated gcode (will be ignored if using binary subcommand)
  -b FILE, --binary-output FILE
                        File in which to save the binary data ready to be fed to the plotter
  -l FILE, --log FILE   File in which to save logs, comments and warnings

Gcode generation options:
  --end-home            Add a trailing instruction to move to (0,0) instead of just taking the pen up
  -s XxY, --size XxY    The size of the print area in millimeters (e.g. 192.7x210.3)
  -d FACTOR, --dilation FACTOR
                        Dilation factor to apply (useful to convert mm to steps)

Plotter connectivity options:
  --simulate            Simulate sending data to the plotter without really opening a connection. Useful with logging enabled to debug the commands sent.
  --port PORT, --serial-port PORT
                        The serial port the plotter is connected to (required unless there is --simulate)
  --baud RATE, --baud-rate RATE
                        The baud rate to use for the connection with the plotter. It has to be equal to the plotter baud rate. (required unless there is --simulate)

About

All the needed software to print images, text or gcode files on a plotter (a pen that moves along two xy axes)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published