A Python interface to a large-format pen plotter

The command and HPGL Classes

Two other important classes are not printed with this article but are available for download from the Raspberry Pi Geek FTP site [5].

The command class doesn't have any functions, just variables. An instance of the command class is instantiated for every command in every HPGL file that gets loaded. This way, I can refer to commands and arguments with meaningful subscripts rather than numerical indexes or slice notation everywhere else.

The HPGL class represents an HPGL file. Each command is represented as an instance of the command class. All of the shift, flip, and visual commands are implemented in the HPGL class.

Conclusion

Although a pen plotter might not be on your list of items to procure, it does provide an interesting glimpse into the history of paper output devices. Because these devices share a very similar operating principal with CNC machines (selecting tools, moving physical media), they are a great training tool before moving on to machines involving wood and metal.

Even though you're limited to lines in just a few colors, that doesn't mean you can't color in areas by hand later. Here's the finished poster after it was fully inked by one of my friends (Figure 7).

Figure 7: The fully inked poster, note the 3D effect done by adding shadows around the original lines.

The Author

Scott Sumner enjoys writing Python code to talk to or control just about anything. He'd like to thank Paul for his recent inspiration at the poker table and Ely for inking the finished poster.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content