AutoLISP has quietly saved drafters millions of clicks over the years. Small routines that number panels, change layers or insert title data can turn repetitive work into a single command. The problem has always been learning the language. AI assistants now make it easier to draft small routines, explain existing code and fix errors. This guide shows how to use ChatGPT for AutoLISP responsibly.
What You Need
- A version of AutoCAD that supports AutoLISP. Full AutoCAD does, and recent AutoCAD LT versions have added support. Check your version's documentation.
- Access to ChatGPT from OpenAI or a similar assistant.
- A test drawing that you can safely experiment on.
- Basic familiarity with AutoCAD commands and object properties.
Write Clear Prompts
AI output is only as good as the request. A strong prompt describes the task, inputs, outputs and constraints:
"Write an AutoLISP routine for AutoCAD called NUMPANEL. It should ask me to select text objects, ask for a prefix such as MP- and a starting number, then replace the text contents in the order I picked them, increasing by 1. Use only standard AutoLISP functions, include comments, and handle the case where I select nothing."
Clear prompts like this produce cleaner code and fewer surprises.
Ideas for Useful Routines
- Panel numbering: sequential codes for marble or cladding panels.
- Layer switcher: move selected objects to a standard layer and set colour ByLayer.
- Area labels: calculate the area of closed polylines and place a text label at the centroid.
- Batch text replace: change a project name across all text in a drawing.
- Quick dimension style: set the current dimension style and layer before dimensioning.
Test Safely
Never run new code on a live project first. Follow a simple routine:
- Save the code in a
.lspfile with a plain text editor or the Visual LISP editor available throughVLIDEor the Visual Studio Code extension, depending on your version. - Open a copy of a drawing or a blank test file.
- Load the file with
APPLOAD. - Run the command on a few objects and check results.
- Use
UNDOto confirm changes can be reverted.
Read the code before you run it. Ask the assistant to explain each part in plain language if anything is unclear.
Fixing Errors With AI
When a routine fails, copy the exact error message from the command line, such as "bad argument type", and paste it with the code into the chat. Ask: "Explain why this error happens and correct the code." Repeat until the routine works. Over time you will start recognising common problems, such as passing a string where a number is expected.
Understand What You Run
AI assistants can produce code that looks correct but uses functions that do not exist, behaves differently in some versions or changes more than you intended. Treat AI output as a first draft from a junior colleague:
- Check that the functions used are documented in the AutoLISP reference in Autodesk help.
- Avoid routines that delete objects or modify files without clear confirmation.
- Keep your routines in a version-controlled folder with notes about what each one does.
Loading Routines Automatically
Once a routine is reliable, add it to the Startup Suite in APPLOAD or to an acaddoc.lsp file so it loads with every drawing. Share tested routines with your team in a common folder and document their command names.
Respect Security
AutoCAD includes security settings that control where executable files can load from. Keep trusted locations limited to folders you control, and do not load LISP files from unknown sources. This protects your drawings and computer from malicious code.
A First Exercise
Ask the assistant for a routine that labels the area of a selected closed polyline in square metres with two decimals. Test it on a simple room, compare the result with the AREA command and adjust the text height. Once it works, you have a small but genuinely useful tool for room schedules and fit-out drawings.
When to Stop and Ask an Expert
If a routine needs to handle thousands of objects, external databases or complex reactors, involve an experienced developer. AI is excellent for small helpers and learning, but larger tools need proper testing and maintenance.
Frequently Asked Questions
Can ChatGPT write AutoLISP that works first time?
Sometimes, but often it needs adjustment. Always test on a copy of a drawing and fix errors before using it on live projects.
Does AutoCAD LT run LISP routines?
Recent AutoCAD LT versions added AutoLISP support. Check the documentation for your version before relying on it.
Is it safe to load LISP files from the internet?
Only load code from trusted sources that you have read and understood, and keep AutoCAD's trusted locations limited.
Related Reading on ShoaibSite
Written by Shoaib Hussan, Founder of D3DDD – Dubai 3D Design & Draft.
Instagram: @mxhaib
Need drawings or 3D? Visit d3ddd.com or email info@d3ddd.com.

ConversionConversion EmoticonEmoticon