AutoCAD & CAD
AutoLISP for Structural Engineers: Practical Automation Examples
AutoLISP pays off on steel drawings when it freezes layers, inserts blocks, extracts attributes, and plots sets. Here are practical patterns—not a huge code dump—for structural teams.
AutoLISP is the automation language already sitting inside AutoCAD. Structural engineers do not need it to become a programming course. They need it to stop doing the same four things on every sheet: freezing markup layers, inserting a grid bubble, extracting title-block attributes, and plotting a set. Those tasks are mechanical. They are also where steel drawings lose an evening. This article stays on practical patterns, with small illustrative snippets rather than a repository dump.
If you want a catalog of office-ready routines, see StruTools LISP Programs. If you want the wider case for automating detailing, see How AutoCAD Automation Can Speed Up Structural Steel Detailing and 10 Repetitive AutoCAD Tasks Structural Engineers Can Automate. What follows is the engineering-flavored middle: enough LISP to see how a command is built, not enough to pretend a blog post is source control for the whole office library.
Two warnings up front. First, LISP will happily repeat a bad standard. If layers are unnamed, a freeze routine has nothing to freeze. Read AutoCAD Layer Standards for Structural Steel Drawings before you script. Second, LISP is not analysis. It will not check a connection or an MBS reaction. Keep calculation tools on the calculation side of the office, including StruTools MBS Reactions when the data is PEB support forces rather than drawing entities.
What AutoLISP is good at on steel drawings
Pick tasks that are repetitive, rule-based, and already named in your CAD standard. Leave judgment tasks to people.
- Layer freeze, thaw, isolate, and restore for issue versus markup sets
- Inserting named blocks (grid bubbles, north arrows, revision clouds) at a point
- Setting attributes on title blocks from a small project list
- Extracting attributes to a table or text file for drawing indexes
- Simple batch plot or scripted publish of a known sheet list
Example: freeze a revision layer before plot
Offices often keep a working markup layer that must not plot. A one-line command is easy to forget on sheet 14. A tiny routine is not.
Conceptually you send the layer command with a freeze option and the layer name from your standard. A sketch of the idea, not a complete error-handled program, looks like this:
Example: insert a grid bubble block
Grid bubbles should be blocks with attributes, not exploded donuts. Insertion is then a point, a scale, a rotation, and an attribute value.
The conceptual call is an insert of a named block at a user point, with scale 1 and rotation 0, followed by the grid letter. In outline: (command "_.-insert" "GRIDBUB" pt "1" "1" "0" gridid). The engineering value is not the parentheses. It is that every bubble on the job is the same block name, so later extract and cleanup can find it. See Using AutoCAD Blocks to Improve Structural Drawing Consistency.
Example: extract title-block attributes
Drawing indexes rot when someone types sheet names by hand. Title blocks already contain the data if you used attributes.
AutoCAD also offers DATAEXTRACTION and related commands. Use those when they already meet the need. Write LISP when you must repeat the extract the same way on every job. Keep the output boring—CSV or a simple table—so it can be checked.
- Select inserts of the title-block name
- Read attributes for sheet number, title, and revision
- Write a row to a text file or a table
- Compare against the transmittal; do not treat the extract as automatically issued
Example: scripted plot of a sheet set
Batch plotting belongs with AutoCAD Batch Processing Ideas for Engineering Teams. LISP or a script file can call a page setup and a plot command per layout.
The pattern is: for each layout in an agreed list, set the page setup, plot to the named device or PDF, and record success or failure. Do not recurse through random DWGs in a working folder. Issued drawings only, same rule as MBS automation. A failed plot should stop the list or write an exception, not skip silently.
How structural teams should store LISP
A routine that lives only in one user's support folder is not an office tool. It is a hobby.
- Keep routines in a versioned office folder, not on a desktop.
- Name them after the task, not after the author.
- Document the layer and block names they expect.
- Load via a controlled startup, not via random APPLOAD at 5 p.m. on issue day.
- Prefer maintained libraries such as StruTools LISP Programs when the task is already a known steel-drawing chore.
Adding one LISP routine to a steel office
One task, one routine, one test drawing. Then the next task.
- Pick a task that happens on every sheet (freeze markups, insert bubble, fill title, plot).
- Write the layer or block names the routine will require into the CAD standard.
- Sketch the command sequence by hand in AutoCAD until it is boring.
- Wrap it in a small defun with a clear error if the name is missing.
- Test on a copy of a real project drawing.
- Store it in the office LISP folder and load it the same way for everyone.
Engineering tips
- Command-line versions of commands (-layer, -insert) are more scriptable than dialog versions.
- Never explode a block inside a routine 'to make editing easier'. You will destroy the next extract.
- Log the drawing name and the routine version when you batch.
- If a task is really batch-across-files, consider a script file plus publish, not only LISP.
- Keep calculation automation elsewhere. LISP does drawings.
Common mistakes
Hard-coding last job's layer names
When the standard changes, the routine will freeze the wrong layer and plot markups. Read names from an agreed list.
Shipping a routine without a missing-name check
Inserting GRIDBUB on a drawing that has no such block will either fail mid-batch or insert a mystery file path.
Using LISP to stretch analysis geometry
If the frame is the wrong width, that is an MBS or STAAD change, not a Lisp scale.
AutoLISP routine acceptance checklist
A routine that fails this list stays on the author's machine.
- Task is repetitive and named in the CAD standard.
- Layer and block names are documented.
- Missing names produce an error, not a guess.
- Tested on a copy of a real steel drawing.
- Stored in the office folder with a version note.
- Does not explode blocks or delete xrefs.
- Does not silently plot working folders.
- Someone besides the author can load and run it.
Frequently asked questions
Do I need to become a programmer to use AutoLISP?
No. You need to understand your CAD standard and be willing to test small routines. Start from StruTools LISP Programs if you want maintained tools rather than a first script.
Is AutoLISP the same as Visual LISP or .NET?
AutoLISP/Visual LISP is the classic in-product language. .NET is a different automation path. For freeze, insert, extract, and plot, LISP is usually enough.
Can LISP extract MBS reactions?
Not meaningfully. Reactions are analysis output. Use StruTools MBS Reactions or a report parser, then place the reviewed table in CAD.
Should every engineer load their own LISP?
No. One office load path. Personal experiments stay off issued drawings.
Small routines, strict names, tested copies
AutoLISP helps structural engineers when it repeats a named standard: freeze this layer, insert this block, extract this attribute, plot this list. Huge anonymous code does not help. It becomes another undocumented tool.
Turn the patterns into a detailing habit with How AutoCAD Automation Can Speed Up Structural Steel Detailing, and keep the task list honest with 10 Repetitive AutoCAD Tasks Structural Engineers Can Automate.
This article provides general educational information. Project-specific structural design, calculations and drawings should be reviewed by appropriately qualified engineering professionals and checked against applicable project requirements and standards. StruTools does not replace engineering judgement or professional design review.