HPGL, short for Hewlett-Packard Graphics Language and often written as HPGL, is a printer control language created by Hewlett-Packard (HP). HP-GL was the primary printer control language used by HP plotters.[1] It was introduced with the plotter HP-9872 in 1977 and became a standard for almost all plotters. Hewlett-Packard's printers also usually support HP-GL/2 in addition to PCL.[2]
This means Arc Absolute, and the parameters place the center of the arc at absolute coordinates 100,100 on the page, with a starting angle of 50 degrees measured counter-clockwise. A fourth optional parameter (not used here) specifies how far the arc continues, and defaults to 5 degrees.
The coordinate system was based on the smallest units one of the HP plotters could support, and was set to 25 μm (i.e. 40 units per millimeter, 1016 per inch).The coordinate space was positive or negative floating point numbers, specifically 230.
The original HP-GL language did not support definition of line width, as this parameter was determined by the pens loaded into the plotter. With the advent of the first inkjet plotters, line width for the "pens" specified within the HP-GL files had to be set at the printer so it would know what line width to print for each pen, a cumbersome and error-prone process. With Hewlett-Packard Graphics Language/2 aka HP-GL/2, definition of line width was introduced into the language and allowed for elimination of this step. Also, among other improvements a binary file format was defined that allowed for smaller files and shorter file transfer times, and the minimal resolution was reduced.
HP-GL is related to AGL (A Graphics Language), an extension of the BASIC programming language. AGL was implemented on Hewlett-Packard minicomputers to simplify controlling a plotter. AGL commands describe the desired graphics plotting function, which the computer relays as several HP-GL instructions to the plotter.
We had a stamping machine. When I got there, they would use the manual typewriter built into it. Needless to say, we scrapped a lot of tags. The machine had a serial interface and I looked up the commands to stamp. Basically, I needed three commands: home, move to, stamp text.
So we created a template for each layout (multiple tags used the same layout so this cut down on the number of templates). A template was defined in a UDxxxA table and each stamped element was defined in the child records. There would be a record for the job number, the part, the serial number, etc. When we went to stamp a tag, it would get the plate number which had the template assigned to it. It would then replace the text value of the various elements and then stamp the text at the location in the template.
Is it like G-code, where you have the option of having absolute subroutines run from a different start point? You save each character as a sub-program that ends with the stylus at the next starting position 0,0 and then call the next letter. I did that 20 years ago programming a CNC to engrave shift knobs (Firehawk #123) when I got tired of creating unique programs for each customer.
HP-GL, short for Hewlett-Packard Graphics Language and often written as HPGL, is a printer control language created by Hewlett-Packard (HP). HP-GL was the primary printer control language used by HP plotters. It was introduced with the plotter HP-8972 in 1977 and became a standard for almost all plotters. Hewlett-Packard's printers also usually support HP-GL/2 in addition to PCL. The language is formed from a series of two letter codes (mnemonics), followed by optional parameters. For instance a...
Roman Verostko (born September 12, 1929) is an American artist and educator who creates code-generated imagery, known as algorithmic art. Verostko developed his own software for generating original art based on form ideas he had developed as an artist in the 1960s. His software controls the drawing arm of a machine known as a pen plotter that was designed primarily for engineering and architectural drawing. In coding his software Verostko conceives of the machine's drawing arm as an extension or ...
Now, being the computer nerd that I am, one of my first inclinations, after seeing the device in action, was wondering how I could control the device directly myself. That is to say, I didn't want to have to import my files into the Silhouette Studio software for every drawing I wanted to make; in particular because I run Linux on my personal desktop, and there is no Linux version of the software available.
After a short bit of research, I discovered that the device communicates via Graphtec's proprietary "GPGL" language, (it stands for Graphtec Plotter Graphics Language, I believe). This is in contrast with the more common HPGL specification found in many other plotters. I did a significant amount of searching on the matter, but came up empty handed when it came to GPGL references. I read some sites that suggested that the Silhouette also communicated via HPGL, but my tests with that came up largely empty.
So, I sent a kindly worded email to Graphtec support asking if they could provide a reference directly. I didn't expect a response back and had resigned myself to the tribulations of USB sniffing. I spent the day, in between work, investigating how to perform USB packet logging on both OS X and Windows (hint: use Windows).
Just like that, I had what I needed! I may or may not have responded back to Neil with professions of love and adulation. I also asked for some quick clarification on one, undocumented point: how does one switch the plotter between GPGL and HPGL mode? He promptly responded back:
The Silhouette does not have an option to manually switch between the two specifications, and in my testing, it does not seem as though the Silhouette automatically switches into HPGL mode either (perhaps someone can correct me on this). That being said, it does seem to be responding to GPGL commands.
To help confirm this, I installed a USB sniffer on my wife's Windows computer, along with with Silhouette Studio software. I had the plotter draw out two simple lines, each about the length of the page. Here is the primary data payload that I saw sent back and forth (in hex):
So, I still have some more tinkering to do, but at least I have an awesome starting point! I thought I should share what I have so that others can find it in the future. Here is a table of all the GPGL commands for quick searching and reference:
Finally had time to work on this. My device (and I would assume many others from the list of supported device in the app I am using) has a simple FTDI serial chip so is accessed as a standard COM port. Then the software passes HPGL commands - pretty basic go to this X and Y coordinate stuff as documented here -GL
Mine is a Vinyl Express R II, Vinyl express rebrands RedSail devices such as those found here
I bought mine second hand and its a smaller one R450 I believe which it looks like they no longer sell
Checking the specs of the larger ones they do sell they call out HPGL as the language so I assume nothing has changed.
Some settings a vinyl cutter need to cater for blade offset, depending on blade and some other factors for a 45 degree blade (there are other blade/degrees on the market, 45 degree is a blade for general usage:
Hi, I need to write a parser for hpgl code received over Serial. I've looked around for examples and the ones I've found are over my head and either can't compile them or can't fix the errors. Sometimes (most times?) trying to reuse code that one doesn't understand is not very useful for either getting the project done or learning.
The first call stops processing when a minus sign or a digit is found, but that delimiter is pointed to, so we need to remove the token and start over with the now-modified string. Otherwise, the next token would begin with the character following the delimiter, which is not what we want.
Thanks for atoi. I had to convert the String datatype to a char array in order to get atoi to work. Probably not the most efficient way to accomplish the task of parsing this sort of incoming data ("PD3450.0,-2202.0;") but it's code I can understand and build on.
Quit some time ago I build a crappy robot arm controller which didnt work too well, but this principle of sending data worked fine..
doing all the difficult calculating on my laptop and have the arduino only reaspond to simple commands,
He has a fairly complete, basic parser but I found the code very Arduino "unfriendly" - lots of compiler issues - and my knowledge of C/C++/the Arduino build process was not sufficient to tech it out. He is also using timers and interrupts and it was hard to uncouple that (again, my insufficient understanding of his code).
I've finally got it working - using his method of scanning the input but basically rewriting the whole thing to work with Arduino (along with coding in a way I can understand and debug). Learned a lot!
Meanwhile I've also been thinking through my whole toolchain and wondering if .hpgl is the best end result, compared to gcode. I think I have settled on using pstoedit as my main conversion utility and its .hpgl export isn't as good as its gcode export. So my whole excursion into hpgl may have been for the learning/scars only ...
What is HPGL-Distiller?
HPGL-Distiller is a small program that was written to filter out aspects of a HPGL file which are notrelevant for various HPGL output devices, typically vinyl cutters. The original reason for filteringout the irrelevant codes was that my own personal vinyl cutter was responding poorly to the excess data.
With the use of HPGL-Distiller, you can now finally use your favorite programs like Inkscape, QCAD, GIMP and many others to produce professional vinyl cutting output results without having to jump back to Windows(tm).How does it work?
The HPGL-Distiller is actually a very simple program (even written in C) that breaks the incomingHPGL data stream into individual HPGL commands and simply copies or ignores each command based on the built in list of 'acceptable' HPGL commands. A lot of HPGL commands generated by pstoedit pertainto aspects of plotting like line type, width, pen colour, pen width and such, all of which aren't always relevant, especially in the cutting processes.
3a8082e126