diff --git a/README.md b/README.md index 81db62a..7413c7c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,120 @@ # DrawingMachines -Code and instructions for operating the drawing machines at Foulab, mainly the plotters. +This repository contains code and instructions for operating the drawing machines at Foulab, mainly the plotters. + + +# TL;DR + +Long instructions are boring, and my attention span is short. I want to plot something right now. + +- Prequisite + - A working python 3. Can be a conda, or a system python. + +- Plot a precreated file + - Linux + - check if you are in the dialout group + ``` + groups + ``` + - if dialout is not listed, add it with + ``` + sudo usermod -a -G dialout user + ``` + logout login may be required + - git clone this repo + ``` + git clone git@github.com:FOULAB/DrawingMachines.git + ``` + - Build a python environment with the necessary code + ``` + ./build_environment.sh + ``` + - Activate this environment + ``` + . /bin/activate + ``` + - Connect the plotter + + Most plotters are driven over serial, using an interface wired in a nonstandard way. For the large HP at Foulab, this is prepared for you. + + INSERT PHOTOGRAPH + + - Probe the plotter + ``` + chiplotle3 + ``` + - Load paper and pen + + INSERT PHOTOGRAPHS + + - Run the test and plot the test file + ``` + plot_hpgl_file + ``` + - Rejoice, you have plotted a drawing! +- Create a file and plot it + - Run this notebook, download the resulting file + - Plot the resulting file + - Rejoice more, you have algorithmically created, and then plotted a drawing! + +# Detailed Discussion + +In the following discussion, we will work from closest to the paper to greater and greater levels of abs + +## Driving the plotter + +The plotter understands HPGL, and it has to be fed this HPGL over a serial port. You can probably achieve this with most serial port communication programs, but a piece of software especially useful for this is Chiplotle. + +Create a python3 virtual environment, and pip install Chiplotle3 (note that pip can also find the chiplotle package, but that is python 2 only) + +Testing + +Loading paper + +Choosing paper + +Choosing pens + +## Making HPGL + +A HPGL file for a specific drawing is plotter specific. The software vpype can be used to generate it, but it needs a configuration file specific to your plotter. You can get this file here. + +Most plotters support 5-8 different pens. In general, registration is good so long as the paper is left in place, so an alternative method of changing pens is to just send separate drawing files. + +Plot requests outside the paper area will be ignored by the plotter – performing this geometric trimming is quite slow, so it is best not to rely on it, but it is a nice safety feature. + +The efficiency of carrying out a plot is related to the geometric instructions given to the plotter. For example, if it is instructed to jump repeatedly from one side of the paper to the other, this will make the plot slower, than if the lines are organized to minimized pen movement. + +Remember this is a physical drawing. You may wish to consider ink and pen effects – e.g. the point where the pen started and ended is often slightly visible. If drawing many circles, and they all start from the same angle, this will be apparent in the final drawing. These effects may or may not be desirable depending on your artistic goal. + +Vpype can be used to draw directly, but this is a bit clunky. It also reads SVG as input. + +## Basic SVG manipulation - VPYPE + +Vpype can be used to perform various simple manipulations which can be used to prepare a file for plotting. These include + +### Sizing +### Layer manipulation +### Framing +### Adding text +### Assembling a page +### Optimizing plot paths + +## Other SVG tools + +### Inkscape + +### Shapely + +### Processing + +## Plotter art – Case studies + +### A postcard, including text + +### Some geometry + +### A map + +### Rendering images 1: Simple Shading + +### Rendering images 2: Single line drawings (TSP) diff --git a/build_environment.sh b/build_environment.sh new file mode 100755 index 0000000..3f3d101 --- /dev/null +++ b/build_environment.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e +if [[ -z "$1" ]] +then + echo "Usage: build_environment.sh environment_name" + echo "Expects to find a workable python3 as 'python'" + exit 1 +elif [[ -e "$1" ]] +then + read -p "$1 exists, delete it? " -n 1 -r + echo # (optional) move to a new line + if [[ $REPLY =~ ^[Yy]$ ]] + then + rm -rf "$1" + else + echo "Not creating env" + exit 1 + fi +fi + +python -m venv "$1" +. "$1"/bin/activate +pip install --upgrade pip +pip install git+https://github.com/cyprienh/chiplotle3.git vpype vpype-ttf diff --git a/fonts/Cantarell-Thin.readme b/fonts/Cantarell-Thin.readme new file mode 100644 index 0000000..b37262e --- /dev/null +++ b/fonts/Cantarell-Thin.readme @@ -0,0 +1,3 @@ +Original download somehow vanished from the web and only distributed as variable now. +Font family designer and license https://cantarell.gnome.org/#download + diff --git a/fonts/Cantarell-Thin.ttf b/fonts/Cantarell-Thin.ttf new file mode 100644 index 0000000..c8f883e Binary files /dev/null and b/fonts/Cantarell-Thin.ttf differ diff --git a/plotter_configs/dxy885.toml b/plotter_configs/dxy885.toml new file mode 100644 index 0000000..b0862e4 --- /dev/null +++ b/plotter_configs/dxy885.toml @@ -0,0 +1,29 @@ +[device.dxy885] +name = "Roland DXY-885" +plotter_unit_length = "0.02489mm" +pen_count = 8 + +[[device.dxy885.paper]] +name = "b" +aka_names = ["tabloid", "ansi_b"] +info = "The switch must be in ansi mode. The drawing offset is from bottom left." +paper_size = ["17in", "258mm"] +x_range = [0, 16640] +y_range = [0, 10365] +y_axis_up = true +origin_location = ["0mm", "0mm"] +origin_location_reference = "botleft" +final_pu_params = "16000,10000" + +[[device.dxy885.paper]] +name = "a3" +aka_names = ["A3"] +info = "The switch must be in iso mode. The drawing offset is from bottom left." +paper_size = ["420mm", "297mm"] +x_range = [0, 16800] +y_range = [0, 11880] +y_axis_up = true +origin_location = ["0mm", "0mm"] +origin_location_reference = "botleft" +final_pu_params = "1r67000,11000" + diff --git a/plotter_configs/hp7595.toml b/plotter_configs/hp7595.toml new file mode 100644 index 0000000..e5ed5b3 --- /dev/null +++ b/plotter_configs/hp7595.toml @@ -0,0 +1,22 @@ + +######################################################################################################################## +# HPGL output devices +######################################################################################################################## + +[device.hp7595a] +name = "hp7595a" +plotter_unit_length = "0.02488mm" +pen_count = 8 + +[[device.hp7595a.paper]] +name = "letter" +aka_names = ["Letter"] +info = "Letter mode is assumed landscape" +paper_size = ["11in", "8.5in"] +x_range = [-4844, 4844] +y_range = [-3177, 3177] +y_axis_up = true +origin_location = ["5.5in", "4.25in"] +final_pu_params = "0,0" +set_ps = 4 +