• 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

CANNON LISP: An Artillery Game Inside AutoCAD

August 6, 2026

A cannon at one end, an ammunition dump somewhere down range, and a parabola between them. Set the elevation and the muzzle velocity and try to land a shot on the target.

What Cannon does

It is a game, but the trajectory is honest. The shot follows

x = x₀ + v cos(a) t
y = y₀ + v sin(a) t - g t²

which is projectile motion with no drag. Doubling the velocity quadruples the range, forty-five degrees carries furthest, and every elevation below that has a matching one above it that lands in the same place. All of that falls out of the maths rather than being faked.

How to use it

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Type CANNON.
  3. Give an elevation angle and a muzzle velocity.
  4. Watch where it lands, and adjust.

How it works

The whole game is drawn as temporary vectors. Nothing is added to the drawing at all, the view is restored, and every system variable goes back. You can play it in the middle of real work and lose nothing.

That is worth saying because the routine this was rebuilt from did the opposite: it set LIMITS to a hard-coded -600,-300 to 1800,1080, turned LIMCHECK off, zoomed to those limits, and set CMDECHO, BLIPMODE and HIGHLIGHT without ever putting any of them back. Its own last instruction was to print “Please QUIT this Drawing” — an honest admission, but not a fix.

The random target. 1980s AutoLISP had no random number function, so the original carried a table of a hundred hand-written decimals. The table is kept — it is perfectly good — but the starting point is taken from the clock, so the targets differ from game to game instead of repeating the same hundred in the same order.

Notes and limits

  • Nothing is added to the drawing and every system variable is restored, so it is safe to run in a live file.
  • No drag. The trajectory is a true parabola, which is why 45° is optimal — real artillery is not so tidy.
  • Temporary vectors clear on the next redraw.
  • There is no undo group, because there is nothing to undo.

Download and details

NameCannon — an artillery game with an honest trajectory
DownloadCannon.lsp — 11.2 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandCANNON
Requiresnothing beyond a CAD platform with AutoLISP.
Source size11.2 KB, 275 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoNot needed — this routine only reads the drawing and changes nothing.
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

  • TOWERHANOI LISP — the other one that draws itself and cleans up after
  • Drafting funnies — the rest of the site’s lighter corner
  • 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