HPGLIN turns a plot file back into geometry. HPGL — Hewlett Packard Graphics Language — is what a drawing became when it was sent to a pen plotter, and a great many drawings survive only as .plt files because the original DWG was lost, was on a machine long gone, or was never handed over.
What HpglImport does
What comes back is polylines, not the original objects. A plot file records pen strokes, so a circle arrives as the short straight segments the plotter drew it with. It is a tracing, not a recovery — but it is to scale, and it beats scanning a print.
Each pen becomes a layer, so the colour separation the plot was set up with survives the trip back.
How to use it
- Load the routine with
APPLOAD, or put it on your support file search path. - Type
HPGLIN. - Choose the
.pltfile. - Confirm the plotter unit scale — 1016 to the inch is the usual, which is 40 to the millimetre.
How it works
The format is simple. Commands are two letters, then arguments, then a semicolon:
IN; initialise
SP2; select pen 2
PU1000,2000; pen up, move to
PD3000,2000; pen down, draw to
PA...; plot absolute — move or draw depending on pen state
Coordinates are in plotter units, and the file is read to its end properly. A hand-written state machine that never checks for the end of file hits nil from the read, passes it on as a bad argument, and every single run finishes by erroring rather than by finishing — leaving the file open and locked until AutoCAD closes.
Notes and limits
- Curves arrive as straight segments. That is what the plotter drew; nothing in the file says “circle”.
- Check the unit scale if the result comes in the wrong size. 1016 per inch is standard but not universal.
- Pen widths are not applied as polyline widths. A table of inch values on a metric drawing puts every line in twenty-five times too thin.
- One undo group covers the whole import.
Download and details
| Name | HpglImport — read an HPGL plot file back into the drawing |
| Download | HpglImport.lsp — 10.1 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Command | HPGLIN |
| Requires | nothing beyond a CAD platform with AutoLISP. |
| Source size | 10.1 KB, 229 lines |
| Error handling | Yes — a *error* handler restores every system variable it changed, on cancel as well as on error. |
| Undo | The whole operation is wrapped in a single undo group, so one U reverses all of it. |
| Compatibility | AutoCAD (any release with AutoLISP), BricsCAD, ZWCAD, GstarCAD, ProgeCAD and other IntelliCAD-based platforms. AutoCAD LT needs a LISP enabler. No .NET, no ObjectARX, no installer. |
| Author | YZ, August 2026 |
| Licence | Free to use, supplied “as is” with no warranty. |
References
- HP-GL/2 plot file format — the format itself, in more detail
- LINEMERGE LISP — tidying the fragments an import leaves behind
- GRIDSNAP LISP — pulling imported geometry back onto a grid
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program