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.
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.

60 routines from Claude, 10 tasks, 2 chats each. Time is how long the reply took; lines count the code only.
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.

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.


How to get a Claude AutoLISP routine into AutoCAD
- 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.
- Copy the code into a text file and save it as
boltc.lsp. Use Notepad or TextEdit in plain text, not Word. - In AutoCAD type
APPLOAD, pick the file and click Load. Close the dialog. - Type the command name, such as
BOLTC, and answer the prompts. Try it in a copy of the drawing first. - If the command line shows
; error:, copy that whole line back into the same chat with “please fix it”.

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.
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.

- A missing argument (Sonnet, TLEN, run 2).
vl-catch-all-applywas 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-getDistAtParamgot 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.

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.

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.

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.
Other people have tried the same thing on video. This walkthrough shows the copy, save and APPLOAD loop in a real AutoCAD:
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 freeIf 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.



