Retro-printing: Using a pen plotter with the Wolfram Language

Jesse Friedman

Join the Conversation #WolframTechConf

What are pen plotters?

One of the earliest physical output devices for computers

Vector graphics (points, lines, and circles, not rows, columns, and pixels)

Before the introduction of the inkjet printer, plotters were the only viable solution for high-resolution color business graphics

The HP7550

The fastest desktop plotter ever produced

6g acceleration

8-pen carousel and auto-feed paper tray

Controlled via serial with HP-GL (HP Graphics Language)

Introduced in 1984 for $3900; sold for ~10 years

Why use integrate an outdated device with WL?

HP-GL is very simple to understand and generate, and it pairs up very well with Wolfram Language symbolic graphics.

And...

...it’s fun!

Look how much fun they’re having!

HPGLLink

<<HPGLLink`

g=HPGLGraphics[{FaceForm[FillType[4]],Pen[7],Rectangle[{0,-1},{2,1}],Pen[6],Disk[],Disk[{3,0},.75],Pen[2],Circle[{2,0}],Pen[5],Dashed,Line[{{-1,0},{4,0}}]}]

Popular Curves

curve=Interpreter["PopularCurve"]["stephen wolfram curve"]

mesh=curve[(EntityProperty["mesh representation", EntityProperty["PopularCurve","MeshRegion"], "EntityProperty[\"PopularCurve\", \"MeshRegion\"]"])]

paths=MeshCoordinates/@ConnectedMeshComponents[mesh]

Short[resampledpaths=ArrayResample[#,Scaled[.05]]&/@paths]

graphic=HPGLGraphics[{Pen[6],Line/@resampledpaths},"Orientation"->"Portrait"]

ToString[graphic]

Image Vectorization

img=

edges=Thinning@EdgeDetect[img,ImageDimensions[img][[2]]/75]

Short[points=Floor@Downsample[ImageValuePositions[edges,1],{2,1}]]

lines=Line/@(points[[#]]&/@FindCurvePath[points])

HPGLGraphics[{Pen[6],lines},"Orientation"->"Portrait"]

Questions?

HP Computer Museum <http://www.hpmuseum.net/>

Initialization

SetDirectory[NotebookDirectory[]];

PrintHPGLGraphics[graphic_]:=URLRead[HTTPRequest["http://10.0.0.4:57550/print",<|"Method"->"POST","Body"-><|"HPGL"->"CV1,100;"<>ToString[graphic]<>"AF;"|>|>]];