• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
blog.draftsperson.net

blog.draftsperson.net

the art of technical drawing

blog.draftsperson.net

HPGLIN LISP: Read an HPGL Plot File Back Into AutoCAD

August 6, 2026

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

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type HPGLIN.
  3. Choose the .plt file.
  4. 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

NameHpglImport — read an HPGL plot file back into the drawing
DownloadHpglImport.lsp — 10.1 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandHPGLIN
Requiresnothing beyond a CAD platform with AutoLISP.
Source size10.1 KB, 229 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoThe whole operation is wrapped in a single undo group, so one U reverses all of it.
CompatibilityAutoCAD (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.
AuthorYZ, August 2026
LicenceFree 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

Filed Under: AutoLISP Routines

Primary Sidebar

Subscribe to our Youtube Channel

Post CAD drafting jobs on Freelancer.com. and get some free money to do this.

Categories

  • American Steel Industry (4)
  • AutoCAD Articles & Reference (30)
  • AutoCAD Bugs & Problems (19)
  • AutoCAD Tips (29)
  • AutoCAD Tutorials (54)
  • AutoLISP Routines (328)
  • AutoLISP Tutorials (15)
  • CAD Standards (7)
  • Civil 3D (7)
  • Civil Drafting (4)
  • Dimensions (2)
  • Drafting Funnies (71)
  • Drafting History (9)
  • Drafting Standards (84)
  • Electrical Drafting (2)
  • General IT reference (7)
  • Geometry (15)
  • GIS (2)
  • Hatch Patterns (12)
  • Office Life Hacks (3)
  • PT (1)
  • Revit Tutorials (54)
  • Steel Detailing (14)
  • Structural Drafting (26)
  • Technical Dictionary (61)
  • Useful Website Links (19)

Footer

Free downloads

  • Free AutoLISP routines
  • Free hatch patterns
  • SHX fonts & text styles
  • Numbering LISP collection
  • ISO 3098B font

Reference charts

  • AWS weld symbols chart
  • Steel detailing chart
  • Hole & slot sizes
  • Bolt edge distance
  • ANSI & ARCH paper sizes
  • How to fold an A1 drawing

Useful links

  • CAD blocks (DWG)
  • Revit families
  • structuraldrafter.com
  • cad-corner.com
  • About
  • Privacy policy

Provided for free with no warranty · Log in