Some okay CMYK results from DrawingBot, finally …

decorative 8-sided symmetrical square tile sketched out in cyan, magenta, yellow and grey felt tip pen on a plotter
drawn using a Roland DXY-1300 plotter on Strathmore Multimedia using DeSerres medium tip pens, ~60 minutes plotting time, 180 × 180 mm

After a tonne of faffing about, I finally got something out of my plotter using Drawing Bot. I’d heard about it during the Bold Machines’ Intro to Pen Plotters course I’m taking, and the results that other people were getting looked encouraging. But for me, they weren’t great.

Maybe I was choosing too large images, but my main problem was ending up with plots with far too many lines: these would take days to plot. The controls on Drawing Bot also seemed limited: density and resolution seemed to be the only controls that do much. Drawing Bot itself wasn’t very reliable: it would sometimes go into “use all the cores!” mode when it was supposed to be idling. It would also sometimes zoom in on part of the image and fail to unzoom without quitting. Is a 32 GB i7 8-core (oldish, but still game) too little for this software? Forget any of the Voronoi plots if you want to see results today.

The source image was a geometric tile that I’d frisketed out years ago, forgotten about, and then found when I unstuck it from under a stack of papers. It’s somewhat artisanally coloured by me in watercolour, and the mistakes and huge water drop are all part of its charm:

geometric tile picked out in brown, red, pink, green  and various shades of faded blue, separated by rough white frisket lines
source image for plotter output

If WordPress will allow an SVG, here’s what Drawing Bot made of it:

scribbly linedrawing of the tile image in CMYK process colours
Drawing Bot SVG output: yes, it’s that faint

I do like the way that Drawing Bot seems to have ignored some colours, like the rose pink around the outside. The green border really is mostly cyan with a touch of black.

I haven’t magically found perfect CMYK pens in HP/Roland pen format. I couldn’t even find the Schwan-Stabilo Point 88 pens that Lauren Gardner at Bold Machines recommends. But the local DeSerres did deliver a selection of their own-brand 1.0mm Mateo Markers that are physically close to the Point 88s in size, but use a wider 1 mm fibre tip. They are also cheap; did I mention that?

The colours I chose were:

  • for cyan: Mint Green; RGB colour: #52C3A5; SKU: DFM-53
  • for magenta: Neon Pink; RGB colour: #FF26AB; SKU: DFM-F23
  • for yellow: Neon Yellow; RGB colour: #F3DE00; SKU: DFM-F01
  • for black: Green Grey 5; RGB colour: #849294; SKU: DFM-80

The RGB colours are from DeSerres’ website, and show that I’m not wildly off. Target process colours are the top row versus nominal pen colours on the bottom:

target vs pen CMYK colours
yes, there are fluo colours in there

I knew to avoid pure black, as it would overpower everything in the plot.

To make the pens work with the DXY-1300, I modified juliendorra/3D-printable-plotter-adapters-for-pens-and-refills: Use your favorite pens with vintage HP plotters: parametric code to create custom adapters to work the the DeSerres pens. Here are my changed files, just in case my PR isn’t accepted:

Overall, it plotted quite well. I plotted directly from Inkscape, one layer/pen at a time, from light (yellow) to dark (grey). Using the pen 1 slot had its disadvantages: the DXY has little pen boots to stop the pens drying, but these unfortunately get filled with old ink. The scribbly dark markings in the NNE and SSW orange kites in the plot are from the yellow pen picking up old black ink from the pen boot. Next time I’ll clean the plotter better.

Delicate tracings from a terrible PRNG

The two orbits of 16-bit RANDU, plotted as X-Y coordinates

I’d previously mentioned RANDU — IBM’s standard scientific PRNG in the 1970s that was somewhat lacking, to say the least —some time ago, but I found a new wrinkle.

For their 1130 small computer system, IBM published the Scientific Subroutine Package [PDF], which included a cut-down version of RANDU for this 16-bit machine. The code, on page 64 of the manual, doesn’t inspire confidence:

c     RANDU - from IBM Scientific Subroutine 
c     Package Programmer's Manual
c     1130-CM-02X - 5th ed, June 1970
c     http://media.ibm1130.org/1130-106-ocr.pdf

      SUBROUTINE RANDU(IX, IY, YFL)
      IY = IX * 899
      IF (IY) 5, 6, 6
 5    IY = IY + 32767 + 1
 6    YFL = IY
      YFL = YFL / 32727.
      RETURN
      END

(If you’re not hip to ye olde Fortran lingo, that bizarre-looking IF statement means IF (IY < 0) GO TO 5; IF (IY == 0) GO TO 6; IF (IY > 0) GO TO 6)

It accepts an odd number < 32768 as a seed, and always outputs an odd number. Yes, it basically multiplies by 899, and changes the sign if it rolls over. Umm …

There are two possible orbits for this PRNG, each 8192 entries long:

  1. Starting seed 1 (899, 21769, 7835, …, 18745, 9003, 1, 899)
  2. Starting seed 5 (4495, 10541, 6407, …, 28189, 12247, 5, 4495).

The plot above is the first series as X and the second as Y. I used INTEGER*2 types to simulate the 1130’s narrow integers.

Thursday Morning Gravity Wells

two sets of osculating circles, one in red, the other blue, offset by 180° to create interference fringes
made with gcmc and some fiddling about in Inkscape

Since I have the MidTBot ESP32 plotter running properly, I thought I should look at better ways of generating G-Code than using BASIC and lots of print statements. Ed Nisley — from whom I’ve learned a lot — always seems to be doing interesting things using the gcmc – G-Code Meta Compiler, and it looks like a useful little language to learn.

Here’s the code to make at least half of the above:

/*
   osculating circles - scruss, 2021-01
   gcmc version

   Usage with midTbot / grbl_esp32:

   gcmc osccirc.gcmc | grep -v '^G64' > osccirc.gcode

   Or for SVG:

   gcmc --svg --svg-no-movelayer --svg-toolwidth=0.25 osccirc.gcmc | sed 's/stroke:#000000/stroke:#C80022/g;' > osccirc.svg
   
*/
comment("osculating circles - scruss, 2021-01");

/* machine constants */
up 	      = [-, -, 5.0mm];
down 	      = [-, -, 0.0mm];
park 	      = [5.0mm, 145.0mm, 5.0mm];
feedrate(6000mm);

/* model parameters */
centre	      = [100.0mm, 75.0mm];
r	      = 65.0mm;
lim_r	      = 3.0mm;
pr	      = r;
a	      = 0.0deg;
da	      = 6.0deg;
sc	      = 0.95;
comment("centre: ", centre, "; r: ", r, "; lim_r: ", lim_r, "; pr: ", pr, "; a: ", a, "; da: ", da, "; sc: ", sc);

/* counter / sense marker */
n	      = 0;

goto(up);
do {
   centre += [(pr-r)*cos(a), (pr-r)*sin(a)];
   goto([centre.x - r, centre.y]);
   goto(down);
   n++;
   if (n%2) {
      circle_cw(centre);
   }
   else {
      circle_ccw(centre);
   }
   goto(up);
   a += 360.0deg + da;
   a %= 360.0deg;
   pr = r;
   r *= sc;
} while (r >= lim_r);

/* end */
comment(n, " circles");
goto(park);

Osculating Circles

Fine gold circles drawn on a black background. Circles decrease evenly in size and are arranged as it to form a spiral from the points where the circles touch
Gold pen on black paper, 13 × 13 cm

So I guess I did learn how to plot circles in G Code successfully …

Rose plots

source by Dan Anderson: https://www.openprocessing.org/sketch/519299
Enlarged and plotted on a Roland DXY pen plotter: 0.7 mm black pen on design vellum.

Full page:

Even if the 0.7 mm pen is a bit chunky for fine guilloché effects, the plotter output is pretty crisp. Here’s a detail at full resolution:

select this to see the full resolution scan. Original is just under 6 cm wide

Unfortunately, an earlier attempt to print this figure using a fresh-out-the-box 20+-year-old HP SurePlot ¼ mm pen on glossy drafting paper resulted in holes in the paper and an irreparably gummed-up pen. If anyone knows how to unblock these pens, I’m all ears …

Plotting a card …

I made this two-colour plotted card for the MeFi “holiday card exchange – v.e.” thing. Pen plotter is a Roland DG DXY-1300 (1990s) using Roland 0.3 mm fibre-tip pens. Plot size is 123 × 91 mm, and is driven entirely from Inkscape 0.92.

Pen plotters: not just output devices …

Pen plotters were pretty expensive and complex pieces of electromechanical equipment. While they often earned their keep in the CAD office, they also had a function that’s almost forgotten: they could be used as input devices, too.

As a kid, we sometimes used to drive past the office of Ferranti-Cetec in Edinburgh. They specialized in digitizers: great big desk or wall mounted devices for capturing points from maps and drawings. Here’s one of their 1973 models:

Ferranti EP210 Freescan Digitiser. Source: Grace's Guide, http://www.gracesguide.co.uk/File:Im1973IME-Ferranti.jpg
Ferranti EP210 Freescan Digitiser. Source: Grace’s Guide, http://www.gracesguide.co.uk/File:Im1973IME-Ferranti.jpg

While the technology and size have changed a bit, these huge bits of engineering kit are the ancestors of today’s track pads and touch screens.

Realizing that their plotters had very precise X-Y indexing and that they had two-way communications to a computer, HP made a drafting sight that fitted in place of a pen on their plotters:

HP drafting sight, part no 09872-60066
HP drafting sight, part no 09872-60066

This is a very pleasing piece of kit, all metal, thick plastic and polished optical glass. They show up on eBay occasionally, and aren’t cheap. With a bit of coercion, it fits into my HP plotter like this:

Drafting sight in HP7470A plotter
Drafting sight in HP7470A plotter

The image is very bright and clear:

Drafting sight near an axis label
Drafting sight near an axis label
Drafting sight over a point
Drafting sight over a point, showing cursor dot

If one has a digitizing sight, one needs to find something to digitize post haste … I’m sure everyone can sense the urgency in that. So I found this, a scan from my undergraduate project writeup (centrifugal pump impeller design ftw, or something), which was probably made on an Amiga or Atari ST:

It's a graph, with pointy bits on it
It’s a graph, with pointy bits on it

I printed this as large as I could on Letter paper, as it’s the only size my HP7470A plotter can take. Now all it needed was a small matter of programming to get the data from the plotter. Here’s a minimally-useful digitizer for HP and compatible serial plotters. Although I ran it on my little HP grit wheel plotter attached to a Raspberry Pi, I developed it with my larger Roland plotter. The only fancy module it needs is pySerial.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# a really crap HP-GL point digitizer
#  scruss - 2016

from time import sleep
from string import strip
import serial

ser = serial.Serial(port='/dev/ttyUSB1', baudrate=9600, timeout=0.5)
lbl = ''
points = []
labels = []
k = 0
retval = 0

ser.write('DP;')                # put in digitizing mode
while lbl != 'quit':
    ser.write('OS;')
    ret = strip(ser.read(size=5), chr(13))
    print ('Retval: ', ret)
    if ret != '':
        retval = int(ret)
    if retval & 4:              # bit 2 is set; we have a point!
        print ('Have Point! Retval: ', retval)
        retval = 0
        ser.write('OD;')
        pt = strip(ser.read(size=20), chr(13))
        print ('OD point: ', pt)
        lbl = raw_input('Input label [quit to end]: ')
        points.append(pt)
        labels.append(lbl)
        k = k + 1
        ser.write('DP;')        # put in digitizing mode again
    sleep(1)
ser.close()

f = open('digit.dat', 'w')
for i in range(k):
    f.write(points[i])
    f.write(',')
    f.write(labels[i])
    f.write('\n')
f.close()

In the unlikely event that anyone actually uses this, they’ll need to change the serial port details near the top of the program.

The program works like this:

  1. Move the drafting sight to the point you want to capture using the plotter’s cursor keys, and hit the plotter’s ENTER key
  2. Your computer will prompt you for a label. This can be anything except quit, that ends the program
  3. When you have digitized all the points you want and entered quit as the last label, the program writes the points to the file digit.dat

I didn’t implement any flow control or other buffer management, so it can crash in a variety of hilarious ways. I did manage to get it to work on the lower trace of that graph, and got these data:

9649,2428,1,300,0
357,2428,1,0,0
357,7217,1,0,0.60
733,3112,1,first
826,3167,1,
968,3256,1,
1122,3334,1,
1290,3405,1,
1588,3583,1,
1891,3725,1,
2215,3880,1,
2526,4051,1,
2830,4194,1,
3143,4280,1,
3455,4516,1,
4077,4767,1,
5008,5229,1,
6543,5954,1,
8067,6548,1,
8740,7195,1,
8740,7195,1,last
8740,7195,1,quit

The first two columns are X and Y, in HP-GL units — that’s 1/40 mm, or 1/1016 inches. The third column will always be 1 if you have the sight down. The last columns are the label; if you put commas in them, opening the file as CSV will split the label into columns. I used it to fudge axis points. You’ll also note that the last three lines of data are my valiant attempts to quit the program …

Assuming the axes are not skewed (they are, very slightly, but shhh) some simple linear interpolation gives you the results below:

 12.1    0.086
 15.1    0.093
 19.7    0.104
 24.7    0.114
 30.1    0.122
 39.7    0.145
 49.5    0.162
 60.0    0.182
 70.0    0.203
 79.8    0.221
 89.9    0.232
100.0    0.262
120.1    0.293
150.2    0.351
199.7    0.442
248.9    0.516
270.7    0.597

Good enough for a demo.

(For prettier things to do with plotter digitizing commands, Ed Nisley KE4ZNU has made some rather lovely Superformula patterns)

If you don’t have a plotter, or even if you do and you don’t have hours to waste mucking about with Python, obsolete optics and serial connections, Ankit Rohatgi’s excellent WebPlotDigitizer (or Engauge, as I found out when this article hit HackerNews in 2021) gets numbers out of graphs quickly. It handles all sorts of graphs rather well.

FifteenTwenty: Commodore 1520 plotter font

FifteenTwentyFor the impatient: download FifteenTwenty-master.zip FifteenTwenty-Regular-OTF.zip (or more options …)
Updated: now with all ASCII glyphs!

Update, September 2016: this font was officially squee‘d over by Josh “cortex” Millard on the Metafilter Podcast #120: Hard Out There For A Nerd. I had the great pleasure of meeting Josh at XOXO 2016, too.

The Commodore 1520 was a tiny pen plotter sold for the Commodore 64 home computer. It looked like this:

Commodore 1520 printer plotter (adjusted).jpg
Commodore 1520 printer plotter — by Oguenther (Dr.Guenther). – This file was derived from Cbm1520-2.jpg: , Public Domain, https://commons.wikimedia.org/w/index.php?curid=39145769

I never owned one, but it seems it was more of a curiosity than a useful product.

From a nerdy point of view, however, this device was rather clever in that it packed a whole plotter command language, including a usable font, into 2048 bytes of ROM. Nothing is that small any more.

Thanks to the epic efforts of Jim Brain and others, this ROM is now archived on Project 64 Reloaded. Looking at the code, I was struck by the elegance of the encoding: it packs a full X-Y plot instruction in one byte.

Based on my work with the Hershey font collection, I thought it would be fun to extract the coordinates and make a real OpenType font from these data. I’m sure others would sense the urgency in this task, too.

Since Commodore computers used a subset of ASCII, there’s a barely-usable set of characters in this first release. Notable missing characters include:

U+005C    \    REVERSE SOLIDUS
U+005E    ^    CIRCUMFLEX ACCENT
U+0060    `    GRAVE ACCENT
U+007B    {    LEFT CURLY BRACKET
U+007C    |    VERTICAL LINE
U+007D    }    RIGHT CURLY BRACKET
U+007E    ~    TILDE

I’ll get to those later, perhaps.

Huge thanks to all who helped get the data, and make the bits of software I used to make this outline font.

(Note: although the Project 64 Reloaded contains some extraction code to nominally produce an SVG font, it doesn’t work properly — and SVG fonts are pretty much dead anyway. I didn’t base any of my work on their Ruby code.)

Broken Pen Girih

broken_pen_girihWell, I didn’t expect that to happen. I was plotting this simple girih frame when something went wrong, and the plotter slammed the (new-old stock, almost unused … sniff) HP drafting pen into the side of the thick watercolour paper, breaking off the tip.

I didn’t notice the damage, so I restarted the plot, and the above smeary and uncertain lines came out. It’s certainly more organic than a mechanical plot would tend to be …

Home-brew Jetstream Plotter Pens

After a relative lack of success in making cheap plotter pens, I managed to score a trove of old pens on eBay. Some of these were dry, and I tried to resuscitate them. A few came back to life, but I ended up with a handful of very dead pen shells.

mystery_pen-alvin_maybe
A dry plotter pen, possibly Alvin

I think the pens were made or sold by Alvin, as there were several empty Alvin trays in the batch I got on eBay. In taking one apart, I thought that a pen refill might just slide inside. Lo and behold, but didn’t the pen nerd’s fave gel pen du jour refill just slide in with enough of an interference fit that it wouldn’t easily slide back out.

Taking the dry pens apart isn’t too easy:

  1. Pull the black tip straight out with pliers; it has a long fibre plug which goes into the ink reservoir. Discard the tip.
  2. While it’s really hard to see, the other end of the pen body has a push-on plug. Gently working around it with a sharp knife can open it up a bit.
  3. Once you’re inside the pen, pull the dry fibre ink reservoir out with tweezers and discard it.

Converting the pen body to use a Jetstream refill needs some tools:

  1. Drill a hole in the plug at the end of the pen body just large enough to allow the end of the refill to pass through. It helps if this is mostly centred to keep the pen point centred; this is important for accurate plots.
  2. Cut a piece of tubing just wide enough to slip over the pen refill, but not quite narrow enough to fit through the hole you just drilled. I used some unshrunk heatshrink tubing for this. It needs to be just long enough to push against the plug when the pen tip is at the right length. This should help stop the refill getting hammered back into the body by your plotter.
  3. Before you assemble the pen, I find it useful to cut a couple of flats in the sides of the plug so you can more easily change the refill. You don’t have to do this, though.
  4. Assemble the pen:
    1. Push the Jetstream refill into the pen body, and adjust it so it sticks out about 6 mm clear of the plastic collar near the nib.
    2. Put the tubing over the other end of the refill, and push the plug over the top, clicking it into place.

img_1220
Three pens in place on my DXY-1300

To get best results, you’ll have to slow your plot speed down quite a bit. At standard speeds, you get a ¼ mm interrupted line which looks like this:

Jetstream at full speed
Jetstream at full speed

Close up, the lines are really faint

A hint that I should run them slower was at the start of each line, where the line would start very thick, then taper off as the ink supply ran low:

acceleration blobs
acceleration blobs

Run at 120 mm/s, the results where a bit darker, but still blobby at the start of lines:

120 mm/s
120 mm/s

Slowing down to 60 mm/s produced slightly better results:

60 mm/s
60 mm/s

But sharpest of all was at the crawling speed 30 mm/s:

30 mm/s
30 mm/s

Some pronounced blobs at the starts of lines still. Here’s the full page at 600 dpi, squished into a very lossy PDF: jetstream_plotter-slow

The blobs could be due to this, though:

grode on pen tip
grode on pen tip

It seems that a mix of paper fibres and coagulated ink builds up on the tip. Occasional cleaning seems to be a good idea. It also seems to help to draw a quick scratch line before anything important so the ink will be flowing properly.

Just to sign off, here’s one of the pens in action:

Gramophone Echoes

gramophone echoesInspired by Robert Howsare’s Drawing Apparatus, a time-step simulation of a similar apparatus was developed. Each trace was made of thousands of straight line segments, one for each rotation of the turntables’ drive motors, and enough to create a closed figure. Suitable gearing was modelled to simulate standard (North American) gramophone speeds of 16â…”, 33â…“, 45 and 78â…• rpm for each of the turntables. Drive crank lengths were derived from standard record sizes. The initial starting angle of each turntable was also modelled.

Three simulation runs were chosen and superimposed. The result was plotted on “A” size vellum using 0.3 mm ceramic drafting pens. Total plot time  at 90 mm/s: 22 minutes.

Code available on request.

Flatbed Plotter Frenzy

Could the DXY-1300's self-test page be more eighties?
Could the DXY-1300’s self-test page be more eighties?

So I finally scored a flatbed from Kijiji. It makes all the right shapes and sounds. Here’s the self-test, all seven minutes of it —

Making cheap HP plotter pens + yet another HP-GL viewer

If you’re running an old plotter, getting pens can be a worry. While there are some companies that might still make them (Graphic Controls/DIA-Nielsen, for one) they are expensive and limited in range. They’re also felt-tip, which means they’ll dry out if not carefully re-capped.

While eBay might supply all things (like these Roland DG plotter pens I scored a couple of days back; fine, black, new old-stock, or these German plotter pens), I also found this:

$_3It’s described as “11.5*28MM cutting plotter vinyl cutter pen holder 50mm for Roland holder Pcut”. I bought two, and eventually the slow boat from China came …

pens

The one on the left is an unmodified pen holder. Well, it’s really a ballpoint-refill holder, as it comes with a (random colour of blue) refill.  To modify these to fit into an HP desktop plotter, you will need to:

  1. Cut ~10 mm from the end of the holder. A Dremel + cutting disk is a satisfying way of doing this. The gap between the knurled bit and  the thread seems to be a decent place. Clean up the sharp edges
  2. As the knurled lock ring will stop the pen engaging in the carriage (my HP-7470A does a lovely little hesitant try… nope; try… nope; try… give up sequence), you’ll have to do without it. Find another way of jamming the threads of the threaded collar in the right place. I used electrical tape, and it’s held so far. Wiser users will use different colours of electrical tape for different pens, ahem …
  3. Stick the pen refill in and tighten down the collet lightly with pliers. ¡¡¡ Do not try to pull the refill out while it is in the collet !!! (The ballpoint insert will likely pop out, and viscous ink will start to blort out everywhere. Ask me how I know!)
  4. Snip the end of the refill flush with the end of the pen holder using diagonal cutters. Best to do this directly over a rubbish bin, as pen ink is nasty. Dab off excess ink from the end of the refill, and clean your cutters, too.
  5. The base of the threaded collar should be around 29 mm from the pen tip, otherwise nothing will plot (if it’s too short) or you’ll poke holes in the paper (if too long). This measurement doesn’t seem to be extremely critical: my Roland pens have it at 28.5 mm, the DIA-Nielsen pens are 28.9 mm. One of my homebrew pens is working at 30½ mm, but then, my basic plotter has no force control, so it may be more forgiving than more elegant beasts.

modified holders and cut/not-so-cut refills

My modified pens look like the above.

The dollar store is a good source of cheap ballpoint pens. I managed to snag 8 retractable red pens for $1.25, and 4 black pens for $1.

one of the donor red pens, plus the disassembled pen holder

(These retractable pens more often than not eject the whole internals across the room when you retract ’em.)

It’s probably a good idea to scribble with the pens a bit before and after modifying them, as they take a while to flow freely. They plot very lightly; the black ink looks more like a faint pencil line.

Double-plotted nested bézier curves
Double-plotted nested bézier curves

If you look close up, not merely are the lines very faint, but something else important shows up:

double-plotted detail, showing off-centre effects (actual size 17 × 17 mm)
double-plotted detail, showing off-centre effects (actual size 17 × 17 mm)

The lines — which should be a constant(ish) distance apart, if the paper has stayed in registration — are showing a varying distance from each other. It looks like the pen points are a little off-centre, so when the pen is swapped out, it gets turned to a slightly different position. This would really only matter for precise work, and I find the effect interesting.

As for the HP-GL viewer? GhostPDL, by the makers of Ghostscript. You’ll have to build it from source, and its documentation isn’t quite where one might want it to be, but it implements a full HP PCL6  / HP-GL/2 interpreter than can output bitmaps, PostScript or PDF. The SVG graphic below was made using the tools/plot2pdf.sh script to convert HP-GL to PDF, then I used ghostscript to convert that to SVG. Nifty!

weave.pltAs a bonus, GhostPDL comes with one of the prettiest plotter fonts ever:
testlb