All articlesTechnology

Claude AutoLISP: 60 Routines Tested, and the Prompts to Use (2026)

Branislav HrivnákBranislav Hrivnák11 min read11:10
A grid of nine images from the Claude AutoLISP test: a bar chart of routines that ran first try, a prompt and Claude's BOLTC routine, the drawings the routines made, a pass and fail grid for all 60 routines, a Claude flange in TechDraw AI's DXF viewer, two highlighted bugs and two pages of Autodesk's AutoLISP reference

Claude AutoLISP routines run first time far more often than not. TechDraw AI asked Claude for 60 routines, 10 everyday drafting tasks in two fresh chats on each of Opus 5.5, Sonnet 5.5 and Haiku 5.5, then ran every one and measured what it drew. Opus got 20 of 20 right first time, Sonnet 19 of 20, Haiku 15 of 20. Below are the exact prompts, the six bugs, and the AutoCAD LT trap to watch for.

Our articles are still written by humans!

Get human written articles in your Google feed.

Add as preferred source TechDraw AI, opens in a new window
FreeUpload a photo · freeGet the drawing a chatbot cannot give youPhotograph the part and get real geometry with real dimensions, not a picture of a drawing. Your first drawing is free, no card needed.Drop a photo here, or click to choose. JPG, PNG or HEIC.

Results: which Claude to use

Each task was asked twice, in two new chats, so each model wrote 20 routines. A routine passed only if it ran without an error and the drawing it left was right: the right number of circles at the right centres and sizes, the right layers, the right total.

Bar chart of AutoLISP routines that ran correctly on the first try: Claude Opus 5.5 20 of 20, Claude Sonnet 5.5 19 of 20, Claude Haiku 5.5 15 of 20
First-try passes out of 20 routines per model. TechDraw AI test, 6 December 2026.

60 routines from Claude, 10 tasks, 2 chats each. Time is how long the reply took; lines count the code only.

Opus 5.5Sonnet 5.5Haiku 5.5
Right first time20 of 2019 of 2015 of 20
Right after one pasted error20 of 2020 of 2018 of 20
Lines of code, average (range)90 (42 to 148)68 (26 to 110)53 (31 to 89)
Reply time, average28 s20 s19 s
Routines with an error handler18122
Routines with ActiveX (vla or vlax) calls722
Functions AutoLISP does not have001 (acos)

Opus writes more code because it adds the things a careful drafter adds: an error handler that restores settings such as OSMODE and CMDECHO, in 18 of its 20 routines, undo grouping so one U removes the whole result, and checks on what you type. Sonnet does most of that in two thirds of the lines. Haiku writes the shortest code, and that is where its mistakes were.

A grid of 10 tasks by 6 runs: all of Opus's 20 cells and 19 of Sonnet's are green; Sonnet's second total length run is yellow, fixed after a pasted error; Haiku has yellow cells for total length and slot in run 1 and flange in run 2, and red cells for total length in run 2 and flange in run 1
Every routine, every run. Yellow means right after one pasted error; red means still wrong after it.

Here is what Opus's first set of routines left in the drawing, read straight back from the files. The flange is the one to look at: bore, outside diameter, eight holes on the pitch circle, and the centre lines on their own layer with the CENTER linetype, from a one-paragraph prompt.

Eight small drawings made by Claude Opus 5.5's routines: six holes on a bolt circle, a plate with four corner holes, an obround slot, a 3 by 4 hole grid, the numbers 5, 6 and 7 at picked points, a flange with eight holes and red centre lines, test circles for the M8 task and circles for the hole table
The drawings Opus's routines made, run 1. Centre lines in red. TechDraw AI test, 6 December 2026.
TechDraw AI's DXF viewer showing the flange drawn by Claude's FLANGE routine: 13 entities on 3 layers, 176 by 176 mm, units millimetres, with the CENTER layer in red
The flange file opened in TechDraw AI's free DXF viewer: 13 entities on 3 layers, units in millimetres.

How to get a Claude AutoLISP routine into AutoCAD

  1. Ask Claude in a new chat. Give the command name, every input in the order you want to be asked, and the result. The prompts below are the ones we used.
  2. Copy the code into a text file and save it as boltc.lsp. Use Notepad or TextEdit in plain text, not Word.
  3. In AutoCAD type APPLOAD, pick the file and click Load. Close the dialog.
  4. Type the command name, such as BOLTC, and answer the prompts. Try it in a copy of the drawing first.
  5. If the command line shows ; error:, copy that whole line back into the same chat with “please fix it”.
A prompt asking for a BOLTC bolt circle routine next to an excerpt of the 71-line routine Claude Sonnet 5.5 wrote: getpoint, getdist and getint prompts with initget 7, then a repeat loop drawing circles with polar between UNDO Begin and UNDO End; the bench result says 6 circles of 11 mm on a 100 mm pitch circle, 60 degrees apart, pass
A prompt and the routine it got. Every model passed this task in both runs.

10 Claude AutoLISP prompts we tested

These are the exact prompts, so you can reuse them or change the numbers. Each one names the command, lists the inputs in order and says what the result is. That is what made them work.

First-try passes out of 2 runs per model. (LT) marks prompts that asked for AutoCAD LT.

TaskOpusSonnetHaiku
Bolt circle (BOLTC)2 of 22 of 22 of 2
Layer setup (MYLAYERS) (LT)2 of 22 of 22 of 2
Total length of lines, arcs, polylines (TLEN)2 of 21 of 20 of 2
Plate with corner holes (PLATE) (LT)2 of 22 of 22 of 2
Move 8.5 mm circles to a layer (M8HOLES)2 of 22 of 22 of 2
Obround slot as one polyline (SLOT)2 of 22 of 21 of 2
Export holes to CSV (HOLECSV)2 of 22 of 22 of 2
Hole grid (HGRID) (LT)2 of 22 of 22 of 2
Number points (NUMPTS)2 of 22 of 22 of 2
Flange front view (FLANGE) (LT)2 of 22 of 20 of 2

Three of the prompts, word for word:

Write an AutoLISP routine, command name SLOT, that draws an obround slot
as one closed polyline with two straight sides and two semicircular ends.
Ask, in this order, for the first centre point, the second centre point
and the slot width.
Write an AutoLISP routine, command name TLEN, that lets me select
objects and prints the total length of all lines, arcs and polylines in
the selection, rounded to 2 decimal places. Ignore anything else I
select, such as circles or text.
Write an AutoLISP routine, command name M8HOLES, that finds every
circle in the drawing with a diameter of exactly 8.5 mm and moves it to
a layer called HOLES-M8, creating the layer if it does not exist. At the
end it should report how many circles it moved. No user input.

The other seven are in the download, with every reply. Four habits made the difference:

  • Name the command, so you know what to type after APPLOAD.
  • List the inputs in order. Every routine that ran asked in the order we gave.
  • Say what to ignore, as in “ignore circles or text”. Every TLEN routine that ran left out the circle and the text we planted next to the lines, arc and polyline.
  • Name the program, AutoCAD LT or full AutoCAD, and Windows or Mac.

The bugs Claude made

Six routines failed the first time. All six were in three tasks, and each failure is a kind of mistake worth knowing.

Claude Sonnet 5.5's TLEN code with vl-catch-all-apply called with only a lambda highlighted in red, the error too few arguments, and a note that the fix passed the object in as a list
Sonnet's only bug: vl-catch-all-apply needs the function and a list of its arguments.
  • A missing argument (Sonnet, TLEN, run 2). vl-catch-all-apply was called with one argument instead of two. Pasting the error fixed it, and the total came out right, 352.83.
  • Too many arguments (Haiku, TLEN, run 1). vlax-curve-getDistAtParam got three. Fixed after a paste.
  • Unbalanced brackets (Haiku, slot, run 1). The file would not even load. Fixed after a paste.
  • A property arcs do not have (Haiku, TLEN, run 2). It read the Length of every object, but an arc has ArcLength, not Length. Not fixed after a paste.
  • A function AutoLISP does not have (Haiku, flange, run 1). It computed pi with acos, which is not in Autodesk's list of 484 AutoLISP functions. The fix replaced it, but the -LAYER line still ended one Enter short.
  • A command left waiting (Haiku, flange, run 2). -LINETYPE was left open the same way. Fixed after a paste.
Claude Haiku 5.5's FLANGE code with two lines highlighted: a -LAYER command ending one Enter short and pi computed with acos, which AutoLISP does not have, above the error no function definition ACOS
Haiku's flange: an invented function and a command left open. The second gives no error at all.
A command left open is the nasty one. AutoCAD shows no error; it just sits inside the LAYER command and the next lines of the routine are read as answers to it. So check what a routine drew, not only that it finished. Half the failures in this test were in the total length task, so test any routine that measures curves on lines, arcs and polylines together.

AutoCAD LT and Mac: the ActiveX trap

AutoCAD LT has run AutoLISP since the 2024 release, and Autodesk's LT help lists the same function reference. But one family of functions comes with a label: the reference files every vla- and vlax- function under “ActiveX Library Functions (Windows only)”. They do not run in AutoCAD for Mac, and AutoCAD LT for Mac runs no AutoLISP at all.

Autodesk's AutoCAD LT 2024 AutoLISP Functions Reference: the heading ActiveX Library Functions (Windows only) and the highlighted note AutoCAD, not AutoCAD LT, also supports the use of third-party ActiveX APIs
Autodesk's AutoLISP reference in the AutoCAD LT 2024 help. Captured 6 December 2026.

The four prompts that said “It has to run in AutoCAD LT 2025 as well as full AutoCAD” got 24 routines with no ActiveX calls at all. Without that line, Opus added vla-StartUndoMark to 5 of its 20 routines, a good habit on Windows that stops the routine on a Mac. The total length task used vlax-curve functions in every run, from every model. If you are on a Mac, say so in the prompt.

The top of Autodesk's Functions Reference (AutoLISP) page in the AutoCAD LT 2024 help, with the alphabetic list and the feature list
Our bench checks every function name against this list. Captured 6 December 2026.

How we tested it

We sent each prompt to Claude through Anthropic's Claude Code command line in plain chat mode: no tools, no files, no project, and a short system prompt saying it is chatting with a user. Each run was a new conversation. We took the code from the reply as it was.

Then we ran the code on a test bench we wrote: an AutoLISP interpreter in Python that keeps a real drawing with ezdxf. It knows the 484 function names in Autodesk's reference, and it emulates the AutoCAD commands these routines call, such as LINE, CIRCLE, PLINE, ARC, TEXT, -LAYER and -LINETYPE, ERASE, MOVE and UNDO, plus entmake, ssget and the vlax-curve functions. Each task has a checker that measures the drawing the routine left, or the text it printed.

If a routine failed, we pasted the error into the same chat once and ran the new code. For two failures we only found after fixing the bench, we did the same in a new chat that quoted the earlier reply.

Be clear about the limits. This is not AutoCAD. On the first pass the bench itself caused about 21 false failures, from things it did not yet emulate; we fixed the bench and re-ran every saved reply without asking Claude again. And two runs per task is a small sample. Everything is in claude-autolisp-test-2026-12.zip: the prompts, every reply, every routine, every drawing and the bench, so you can run any routine in your own AutoCAD.

Other people have tried the same thing on video. This walkthrough shows the copy, save and APPLOAD loop in a real AutoCAD:

Maike's walkthrough of asking Claude for an AutoLISP routine and loading it in AutoCAD. Not made by TechDraw AI.

Where TechDraw AI fits

TechDraw AI is our product, so weigh this section with that in mind. AutoLISP is great once the geometry is in AutoCAD. It cannot help when what you have is a part on the bench or a photo of one. That is the step TechDraw AI does: photograph the part, give one measurement, and get a dimensioned drawing as DXF or DWG to open in AutoCAD and run your routines on. The first drawing is free; after that a drawing costs 5 credits, and the Starter plan is €29 for 120 credits.

Turn a photo of a part into a dimensioned DXF, then let your AutoLISP routines do the rest.

Try TechDraw AI free

If you want Claude to work inside AutoCAD rather than write code for you to load, see how to connect Claude to AutoCAD. For the ChatGPT side, there is our ChatGPT prompts for AutoCAD, and for Autodesk's own Claude add-ons, Autodesk's Claude skills. The full list of AI tools that work with AutoCAD is in the best AI tools for AutoCAD.

FAQ

Frequently asked questions

Can Claude write AutoLISP?

Yes. In TechDraw AI's December 2026 test, Claude Opus 5.5 wrote 20 routines out of 20 that ran and drew the right result first time, Claude Sonnet 5.5 19 of 20 and Claude Haiku 5.5 15 of 20, over 10 everyday drafting tasks. The routines were run on our AutoLISP test bench, not inside AutoCAD, so load each one in a copy of your drawing first.

Which Claude model is best for AutoLISP?

Claude Opus 5.5 if you can use it: it was right first time in all 20 of TechDraw AI's runs and wrote the most careful code, with error handlers and undo grouping. Sonnet 5.5 was nearly as good, 19 of 20, and its one bug was fixed by pasting the error back. Haiku 5.5 invented a function and left commands unfinished; keep it for small routines.

Does Claude AutoLISP code work in AutoCAD LT?

Mostly, if you say so in the prompt. AutoCAD LT runs AutoLISP from version 2024. In TechDraw AI's test the four prompts that named AutoCAD LT got routines with no ActiveX calls at all. Without that hint, Opus added vla undo marks in 5 of 20 routines; Autodesk lists those functions as Windows only, so they fail on a Mac.

What should I do when a Claude routine gives an error?

Paste the exact error line from the AutoCAD command line back into the same chat and ask for a fix. In our test that fixed 4 of the 6 routines that failed. The two it did not fix were Haiku's; one still left the LAYER command waiting for an Enter, which gives no error at all, so also check what the routine drew.

How do I load a Claude AutoLISP routine into AutoCAD?

Save the code as a .lsp file, type APPLOAD in AutoCAD, pick the file and click Load, then type the command name Claude gave it, such as BOLTC. For a quick try you can also paste the code straight onto the command line. To load it every session, add it to the Startup Suite in the APPLOAD dialog.

Is Claude better than ChatGPT for AutoLISP?

We have not run ChatGPT on this exact set yet, so we will not say. What we can say is that Claude Sonnet 5.5 and Opus 5.5 got 39 of 40 routines right first time here, and that the mistakes worth checking for are the same for any model: functions AutoLISP does not have, commands left unfinished and ActiveX calls on a Mac.

Sources

  1. Autodesk: AutoCAD LT 2024 Help, Functions Reference (AutoLISP)
  2. Anthropic: Claude models overview
  3. ezdxf: Python library used by our test bench to build and measure the drawings

Audio version by TechDraw AI

Listen to this article

Prefer to listen? Matthew and Bryan, the founders of TechDraw AI, talk through Claude AutoLISP: 60 Routines Tested, and the Prompts to Use (2026) in about 11 minutes. The voices are AI-generated. Every section is a chapter, so you can jump straight to the part you need while you work on a drawing.

Chapters (7)

More narrated articles on TechDraw AI