Quick Access Search All Tools Ctrl+K Help & Tool Guide

A command macro is a string of text that types commands, options and values into AutoCAD for you, exactly as if you typed them at the Command prompt. Put that string behind a ribbon button, a tool palette icon, a right-click menu or a keyboard shortcut, and a ten-step routine becomes one click. Everything here works in AutoCAD 2024, 2025 and 2026, AutoCAD LT for Windows, and the AutoCAD-based toolsets. No programming install, no compiling, nothing to load.

This page takes you from zero to advanced: why macros matter, the basics of writing one, advanced techniques (DIESEL, AutoLISP, toggles, repeats), a full lexicon of every special symbol, and an interactive Macro Builder that exports ready-to-paste macros, .lsp commands, .scr scripts and a shareable library file.

^C^C_.-LAYER;_M;E-OH-PRI;_C;1;;;_.PLINE; One click: cancel anything running → make/set layer E-OH-PRI → color it red → start a polyline. The user just picks points.
📄 Prefer paper? Download the AutoCAD 2024–2026 Command Macro Guide (PDF). It has the Why, Basics, Advanced and Lexicon sections, the version compatibility table, and a one-page symbol quick-reference card. It works offline once the site is cached.

1 — Why You Should Use Macros

Every drafter repeats the same handful of sequences hundreds of times a week: set a layer, start a command, pick an option, type the same value. Each step is a chance to grab the wrong layer, forget an option, or burn seconds you don't get back. A macro records that sequence once and replays it perfectly every time.

⏱ Speed

A typical "set layer + start command" takes 8–15 keystrokes and 2 dialogs. A macro does it in one click. 40 uses a day × 10 seconds saved = almost 7 minutes a day, or about 28 hours a year per drafter, from one button.

📏 Standards enforcement

The macro always puts conductors on E-OH-PRI, color 1, with the right linetype. Nobody has to remember the layer list. That makes it easier to pass a CHECKSTANDARDS review and keeps drawings consistent across the whole team.

⚠ Fewer errors

Wrong layer, wrong scale, wrong block, forgotten ATTREQ setting: macros remove the human step where mistakes happen. If the macro is right once, it's right forever.

🎓 Faster onboarding

New hires don't need to memorize your company's 14-step pole-symbol workflow. They click the Insert Pole button. The macro holds the knowledge.

🧰 No programming required

If you can type it at the Command prompt, you can macro it. Macros are just the Command-prompt conversation written as one line. That makes them the easiest automation to learn in AutoCAD.

📦 Portable & shareable

Macros live in CUIx files, tool palettes, and the Command Macros palette (2024–2026). Put them in a shared partial or enterprise CUIx and the whole office gets the same buttons.

💻 Works in AutoCAD LT

Macros run in full AutoCAD and AutoCAD LT for Windows. LT 2024+ also runs AutoLISP, so even hybrid LISP macros work across your licenses.

🤖 AutoCAD helps you find them

The Macro Advisor in AutoCAD 2024, 2025 and 2026 (COMMANDMACROS) watches the command sequences you repeat and suggests macros. Save them, edit them, and add them to the ribbon's Automation tab.

Version compatibility: AutoCAD 2024, 2025 & 2026

Command-macro syntax hasn't changed across these three releases, so every macro, symbol and export on this page works the same in AutoCAD 2024, 2025 and 2026. The differences are in which product you run (full AutoCAD, LT, or Mac), not which year.

Feature202420252026AutoCAD LT (Win)AutoCAD for Mac
Core macro symbols (^C ; \ _ . - * ' ^Z ^P ^Q ^R, toggles)✔✔✔✔✔ (Customize dialog)
^] select-if-needed (added in 2023)✔✔✔✔—
DIESEL $M= expressions✔✔✔✔✔
AutoLISP inside macros / Builder .lsp export✔✔✔✔ LT 2024+✔ AutoCAD only (no LT for Mac)
Scripts / Builder .scr export✔✔✔✔✔
CUI editor, partial & enterprise CUIx✔✔✔✔Customize dialog instead
Tool palette command strings✔✔✔✔—
Command Macros palette / Macro Advisor (COMMANDMACROS)*✔✔✔✖✖
Action Recorder (.actm)✔✔✔✖✔
UNDEFINE (why the . prefix matters)✔✔✔✔ LT 2024+✔
* The Macro Advisor (introduced in AutoCAD 2023) is a My Insights feature of full AutoCAD for Windows. It isn't in the AutoCAD-based toolsets, and the Insights tab needs a commercial named-user subscription with "My Insights – Macro Advisor" assigned to your Autodesk account. Saved macros, the Command Macro Editor and Add to Ribbon (Automation tab) work the same in 2024, 2025 and 2026.
💡 Mixed-version office? Write macros with the _. prefixes and dash commands taught here, and a single partial CUIx or .lsp file works on 2024, 2025 and 2026 machines side by side. If a prompt sequence ever differs between releases, the ^R (command versioning) symbol is the escape hatch.

Macros vs. the other automation tools

Macros are one of five ways to automate AutoCAD. Pick the simplest one that does the job:

ToolWhat it isBest forLimits
Command alias (.PGP)A short name for one command (L = LINE)Starting a single command fasterNo options, no values, no sequences
Command macroA one-line string of commands, options, values and pausesButtons, palettes, menus, double-click actions, shortcut keysMostly linear, with no loops; logic is limited to DIESEL/LISP snippets
Script (.SCR)A text file of Command-prompt input, run with SCRIPTBatch jobs across many drawings, drawing setupNo pauses for user input
Action Recorder (.ACTM)Records what you do and plays it backQuick personal recordingsFull AutoCAD only (not LT); harder to edit and share than a text macro
AutoLISP (.LSP)A full programming languageLoops, logic, math, reading/writing data, new commandsHas to be loaded (APPLOAD/acaddoc.lsp); there's more to learn
💡 Rule of thumb: if the task is "do these same steps, maybe let me pick a point," it's a macro. If it needs "for each…" or "if this, then that," graduate to AutoLISP. The Builder on this page exports both.

Where macros live (AutoCAD 2024–2026)

LocationHow to get thereNotes
Ribbon buttonCUI → Customize tab → Ribbon → PanelsMost visible; good for team tools
Quick Access ToolbarCUI → Quick Access ToolbarsAlways on screen, whatever ribbon tab is showing
Tool palette command toolTOOLPALETTES (Ctrl+3) → tool Properties → Command stringEasy to drag and share; see Tool Palettes
Right-click (shortcut) menuCUI → Shortcut MenusContext-sensitive (Default, Edit, Command modes)
Keyboard shortcutCUI → Keyboard Shortcuts → Shortcut KeysMacros assigned to keys cannot use \ pauses
Double-click actionCUI → Double Click ActionsRuns a macro when you double-click a given object type
Command Macros palette (2024–2026)COMMANDMACROS → Saved tabStored in commandmacros.cuix; "Add to Ribbon" puts it on the Automation tab

2 — Basic Macro Programming

Beginner

The one idea you need: a macro is the Command-prompt conversation, typed out

When you run a command, AutoCAD asks questions (prompts) and you answer them. A macro writes your answers down in order, with a symbol for every Enter and every "let the user pick." That's all it is.

Example: draw a circle with radius 5 wherever the user clicks.

AutoCAD asks…You would…Macro piece
Command:Press Esc twice to clear anything running^C^C
Command:Type CIRCLE, press Enter_.CIRCLE;
Specify center point for circle…Click a point\ (pause)
Specify radius of circle…Type 5, press Enter5;
^C^C_.CIRCLE;\5;

Anatomy of a macro

^C^Ccancel _.-LAYERcommand ;enter _Moption ;enter E-OH-PRIvalue ;enter _Coption ;enter 1value ;;;3× enter _.PLINEcommand ;enter
  • Cancel (^C^C): starts from a clean Command prompt. It equals pressing Esc twice. Two are needed to back out of dimension commands and nested prompts.
  • Command: the command name. The - in -LAYER calls the command-line version, so no dialog box opens. Dialogs stop macros.
  • Option: the capital letters of an option, e.g. M for Make, C for Color.
  • Value: a typed answer: a layer name, a number, a coordinate.
  • Enter (;): every answer has to be "entered." Extra semicolons accept defaults and exit commands.

Translate the Command prompt step by step: the "write the conversation" method

This is how pros build every macro. Run the command manually at the Command prompt, press F2 to open the text window, and write down each prompt and your answer.

#Prompt shownYour answerMacro
1Command:-LAYER_.-LAYER;
2Enter an option [?/Make/Set/New/…/Color/…]:M_M;
3Enter name for new layer (becomes the current layer) <0>:E-OH-PRIE-OH-PRI;
4Enter an option [?/Make/Set/…]:C_C;
5New color [Truecolor/COlorbook]:11;
6Enter name list of layer(s) for color 1 <E-OH-PRI>:(Enter = accept);
7Enter an option [?/Make/Set/…]:(Enter = exit LAYER);
8Command:PLINE_.PLINE;

String the "Macro" column together and put ^C^C in front:

^C^C_.-LAYER;_M;E-OH-PRI;_C;1;;;_.PLINE;

The 10 beginner rules

  1. Start with ^C^C so the macro never types into a command that's already running.
  2. Use the dash version of commands (-LAYER, -INSERT, -PURGE, -HATCH, -PLOT) so no dialog box opens. A macro can't click inside a dialog.
  3. Use ; for Enter, not spaces. A space is Enter most of the time, but inside text it's a real space, and you can't see it at the end of a line. Semicolons are visible and predictable.
  4. Use \ to pause for the user to pick a point, type a value or select objects.
  5. Prefix commands with _.: _ makes it work in any language version, and . uses AutoCAD's built-in command even if someone redefined it.
  6. Prefix options with _ too (_M, _E, _W). Don't put it on your own values like layer names.
  7. Know the end-of-macro space. AutoCAD adds a space (Enter) to the end of every macro, unless the macro ends in ;, \ or a control character such as ^Z. So ^C^C_.LINE and ^C^C_.LINE; both start LINE.
  8. Use forward slashes in file paths (C:/CAD/Blocks/pole.dwg). A backslash is a pause.
  9. Avoid spaces in names and paths (they act as Enter). If you must use them, use the AutoLISP form (see Advanced).
  10. Test at the Command prompt first. Type the sequence by hand. If it works by hand, it'll work as a macro.

Create your first macro button in the CUI (AutoCAD 2024–2026)

  1. Type CUI and press Enter. The Customize User Interface editor opens.
  2. On the Customize tab, in the Command List pane (lower left), click the Create a new command button (the star icon).
  3. In the Properties pane on the right, set Name (e.g. Overhead Primary PLINE) and Description (the tooltip).
  4. Click in Macro and replace the default ^C^C with your full macro. For long macros, click […] to open the Long String Editor.
  5. Optional: assign a Small Image / Large Image (16×16 and 32×32 BMP/PNG) and an Element ID like UD_OHPRI.
  6. Drag the new command from the Command List onto a Ribbon → Panel, a Quick Access Toolbar, a Shortcut Menu, or under Keyboard Shortcuts → Shortcut Keys.
  7. Click Apply, then OK. Your button is live. Click it and watch the Command prompt to check each step.
📎 Faster option: Tool Palettes. Open TOOLPALETTES (Ctrl+3), drag any existing command (for example LINE from a ribbon button) onto a palette, right-click it → Properties, and paste your macro into Command string. See the Tool Palettes guide.
🆕 AutoCAD 2024–2026: Command Macros palette. Type COMMANDMACROS. The Insights tab shows macros AutoCAD suggests from your own command history (named-user commercial license required). Try or Save them, then right-click a saved macro → Edit Macro to paste in your own string, or → Add to Ribbon to place it on the Automation tab. These macros are stored in commandmacros.cuix.

Starter macros to try today

MacroWhat it does
^C^C_.ZOOM;_E;Zoom Extents
^C^C_.UCS;_W;_.PLAN;;Reset to World UCS and plan view
*^C^C_.ERASE;_SI;Erase one picked object at a time, repeating until you press Esc
^C^C_.-LAYER;_M;E-DIM;;_.DIMLINEAR;Make/set layer E-DIM, then start a linear dimension
^C^C_.CIRCLE;\5;Circle with radius 5 at a picked center
^C^C_.-PURGE;_A;*;_N;Purge all unused items with no confirmation prompts
^C^C_.LAYFRZ;Freeze the layer of whatever you pick

Debugging a macro that "doesn't work"

  • Press F2 and read the Command history line by line. The macro stops at the exact prompt where its answer didn't fit.
  • A dialog opened? Use the dash command, or set FILEDIA to 0 for file prompts. Remember to set it back to 1.
  • Too many or too few ;? Count the prompts again. Command options change between releases and settings (e.g., the Y-scale prompt in -INSERT disappears for uniformly scaled blocks).
  • Attribute prompts appeared? That's ATTREQ/ATTDIA. Either answer them in the macro or set ATTREQ to 0 first.
  • Works for you but not a co-worker? Add _ and . prefixes, and check they have the same layers, blocks and support paths.

3 — Advanced Macro Creation

Advanced

Repeating macros: *^C^C

A leading asterisk makes the macro repeat until you press Esc or pick another macro that starts with ^C. Pair it with Single selection mode so each pick runs the command once:

*^C^C_.ERASE;_SI;          ← erase one object per pick, forever
*^C^C_.MOVE;_SI;          ← pick one object, then base/second point; repeats
*^C^C_.ROTATE;_SI;        ← pick one object, then base point/angle; repeats
⚠ The * must be the very first character, and you can't use it to repeat options. It also doesn't work in image tile menus.

Transparent commands: '

An apostrophe runs a command inside another command without cancelling it, for example zooming or changing a setting mid-LINE. Never put ^C in front of a transparent macro, because that would cancel the command you're trying to help.

'_.ZOOM;_E;                ← zoom extents without leaving the current command
'_ORTHOMODE;1;             ← set a system variable transparently

Selection-set tricks

InputMeaningExample
_SISingle: select once, then continue automatically^C^C_.MOVE;_SI;\\\
_PPrevious selection set^C^C_.CHPROP;_P;;_LA;E-DEMO;;
_LLast object created^C^C_.CHPROP;_L;;_C;1;;
_ALLEverything not on frozen/locked layers^C^C_.-PURGE;_A;*;_N;
\ at Select objectsEach \ accepts one pick or one window; add ; to finish selecting^C^C_.ERASE;\;
^]Prompt to select only if nothing is preselected (2023+)^C^C^]_.CHPROP;_P;;_C;3;;

Coordinates in macros

  • @10,0: relative to the last point. @10<45: relative polar (distance<angle).
  • #0,0: absolute coordinate even when Dynamic Input would make it relative.
  • 0,0 after an option like _.MOVE;_L;;0,0;\ moves the last object from the origin to a picked point.
  • Object snap overrides work as inputs: _END;\ forces Endpoint for that pick, _MID;\ Midpoint, _NON; no snap.
^C^C_.LINE;_END;\@0,-10;;   ← line from a picked endpoint straight down 10 units

Echo control: ^P, ^Q, MENUECHO, CMDECHO

Macros "type" into the Command prompt, so every step echoes. ^P toggles MENUECHO to hide the noise, and ^Q keeps the macro's prompts and input out of the Command history. In LISP-based macros, set CMDECHO to 0 and restore it afterwards.

^C^C^P_.-LAYER;_M;E-OH-SEC;_C;5;;;^P_.PLINE;

Suppressing the automatic final space: ^Z

AutoCAD appends a space (Enter) to any macro that doesn't end in ;, \ or a control character. Usually that's what starts the last command. When it isn't wanted, especially after a DIESEL test that might return nothing (an extra Enter would repeat the last command), end with ^Z.

DIESEL: logic inside a macro with $M=

DIESEL (Direct Interpretively Evaluated String Expression Language) lets a macro make decisions. $M= tells AutoCAD "evaluate the rest of this as DIESEL." DIESEL functions are written $(function,arg1,arg2,…), with commas and no spaces.

Toggle any 0/1 system variable: subtract the current value from 1.

^C^C_GRIDMODE;$M=$(-,1,$(getvar,gridmode))
^C^C_MIRRTEXT;$M=$(-,1,$(getvar,mirrtext))
^C^C_FILLMODE;$M=$(-,1,$(getvar,fillmode))

If/then, e.g. switch between Model and Paper space inside a layout (the trailing space inside each result is the Enter, because ^Z suppresses the automatic one):

^C^C$M=$(if,$(=,$(getvar,cvport),1),_.MSPACE ,_.PSPACE )^Z

Cycle text height 0.08 → 0.10 → 0.12:

^C^C_TEXTSIZE;$M=$(if,$(=,$(getvar,textsize),0.08),0.10,$(if,$(=,$(getvar,textsize),0.10),0.12,0.08))
DIESEL functionDoesExample → result
$(getvar,name)Reads a system variable$(getvar,clayer) → E-OH-PRI
$(if,test,then,else)Branch: test is true if non-zero$(if,$(getvar,gridmode),ON,OFF)
$(=,a,b) $(!=,a,b)Numeric equal / not equal (1 or 0)$(=,$(getvar,tilemode),0)
$(<,a,b) $(>,a,b) $(<=,a,b) $(>=,a,b)Numeric comparisons$(>,$(getvar,ltscale),1)
$(eq,a,b)String equal$(eq,$(getvar,clayer),0)
$(+,..) $(-,..) $(*,..) $(/,..)Math (up to 9 arguments)$(*,$(getvar,dimscale),0.125)
$(and,..) $(or,..) $(xor,..)Bitwise logic, useful for bit-coded sysvars$(and,$(getvar,osmode),16384)
$(fix,n)Truncates to an integer$(fix,48.7) → 48
$(rtos,n,mode,prec)Number to text (mode 2 = decimal, 4 = architectural)$(rtos,$(getvar,ltscale),2,0)
$(angtos,a,mode,prec)Angle to text$(angtos,$(getvar,snapang),0,2)
$(edtime,time,format)Formats a date$(edtime,$(getvar,date),MO/DD/YYYY)
$(strlen,s) $(substr,s,start,len) $(upper,s)String length / substring / uppercase$(substr,$(getvar,dwgname),1,6)
$(index,n,list) $(nth,n,a,b,..)Picks an item from a comma list / argument list$(nth,1,A,B,C) → B
$(getenv,name)Reads a registry environment value$(getenv,MaxArray)
$(linelen)Width of the status display, in charactersRarely needed
$(eval,str)Evaluates a string as DIESELAdvanced nesting

edtime picture codes: D DD DDD (Mon) DDDD (Monday), M MO MON MONTH, YY YYYY, H HH MM SS MSEC, AM/PM.

🏷 DIESEL in menu labels: in classic pull-down/shortcut menu names, a DIESEL expression that returns !. shows a check mark and ~ greys the item out, e.g. $(if,$(getvar,gridmode),!.)Grid. Ribbon buttons don't evaluate label DIESEL.

AutoLISP inside macros (hybrid macros)

Full AutoCAD and LT 2024+ evaluate AutoLISP expressions typed at the Command prompt, so a macro can include them. That gets around most macro limits: spaces in paths, prompts, math, and restoring settings.

;; Ask for a layer name once, then make it current
^C^C(setq lyr (getstring T "Layer name: "));_.-LAYER;_M;!lyr;;

;; Insert a block whose path contains spaces (macros can't do this alone)
^C^C(command "_.-INSERT" "C:/CAD Library/Utility/POLE-WOOD.dwg" pause 1 1 0)

;; Load a LISP file, then run its command
^C^C(load "C:/CAD/Lisp/poletag.lsp");POLETAG;

;; Date-stamp text using DIESEL from inside LISP (assumes text style height = 0)
^C^C(command "_.TEXT" pause "" "0" (menucmd "M=$(edtime,$(getvar,date),MO/DD/YYYY)"))

;; Set LTSCALE & DIMSCALE from one scale factor the user types
^C^C(setq sf (getreal "Scale factor (e.g. 48): "));_LTSCALE;!sf;_DIMSCALE;!sf;
  • !variable feeds the value of a LISP variable into any prompt.
  • pause inside (command ...) works like \, and "" works like ;.
  • Avoid backslashes inside LISP code in a macro (such as "\n" in prompts). The macro reader can treat them as pauses. Use forward slashes in paths and keep prompts simple.

Undo-safe macros

Wrap multi-step macros in an undo group so one U reverses the whole thing:

^C^C_.UNDO;_BE;_.-LAYER;_M;E-POLE;;_.-INSERT;POLE-WOOD;\1;;0;_.UNDO;_E;

Running scripts from a macro

^C^C_FILEDIA;0;_.SCRIPT;C:/CAD/Scripts/sheet-setup.scr;

Set FILEDIA back to 1 as the last line of the script. Anything after SCRIPT in the macro would be fed into the script's prompts.

Deploying macros to a team

  • Partial CUIx: in CUI → Transfer tab, create a new file (e.g. UtilityDrafter.cuix), drag your commands, ribbon panels and toolbars into it, and save it to a network folder. Each user loads it with CUILOAD, or you attach it as a partial customization file.
  • Enterprise CUIx: a read-only, company-wide CUIx set in OPTIONS → Files → Customization Files → Enterprise Customization File. Users get your buttons and can't break them.
  • Tool palettes: export a palette (.XTP) or point everyone's Tool Palettes File Locations at a shared folder.
  • LISP wrappers: a macro wrapped as (defun c:OHPRI ...) in an auto-loaded .lsp becomes a typed command. The Builder below generates this for you.

Common advanced pitfalls

• Keyboard shortcuts can't pause. \ isn't supported in macros assigned to shortcut keys. Use a LISP wrapper instead.
• Prompts change with settings. -INSERT asks for Y scale only if the block allows non-uniform scale; attribute prompts depend on ATTREQ; TEXT asks for height only if the style's height is 0.
• Layer prompt nesting. Autodesk notes that some -LAYER option states need ^C^C^C to fully cancel. Use three cancels if a layer macro misbehaves after another layer macro.
• Don't ^C a transparent macro. Transparent macros start with ', not ^C^C.
• Command versioning (^R). If a macro written for an old release breaks in a newer release (e.g. a 2024 macro in 2026) because a command's prompts changed, ^R turns command versioning on so the older prompt sequence is used where it's supported.

4 — Lexicon: Every Macro Symbol Explained

Every character in a macro means something, even a space. Use this table as your decoder ring. Click any symbol in the first column to copy it.

SymbolNameWhat it doesExampleLevel
^CCancelSame as pressing Esc. Cancels the active command or option.^C_.LINEBasic
^C^CDouble cancelStandard macro opener. Two cancels are needed to back out of dimensioning and nested prompts. Some -LAYER states need ^C^C^C.^C^C_.CIRCLE;\5;Basic
;EnterPresses Enter: submits a value, accepts a default, or ends a command. No space is added after a trailing ;._.PLAN;;Basic
(space)SpacebarSame as pressing the Spacebar. It acts as Enter at most prompts but types a real space inside text strings. Use ; for clarity.^C^C_.circle \5Basic
\PauseWaits for user input: a point, distance, value, or one pick/window at Select objects (follow it with ; to end selection). Not allowed in keyboard-shortcut macros._.LINE;\\;Basic
_Global nameUses the English (global) name of a command or option, so the macro works in every language pack._.ZOOM;_E;Basic
.Built-in commandUses AutoCAD's standard command even if it was changed with UNDEFINE or redefined by LISP. Combine as _. or ._._.ERASEBasic
-Command-line versionRuns the command without its dialog box, which macros need. Not every command has one._.-LAYER _.-INSERTBasic
*RepeatAs the first character (*^C^C), repeats the macro until Esc or another ^C macro runs. Can't repeat options.*^C^C_.ERASE;_SI;Advanced
'TransparentRuns a command inside another command without cancelling it. Don't put ^C in front.'_.ZOOM;_E;Advanced
^ZNull / no final spaceStops AutoCAD from adding its automatic final space (Enter) to the end of the macro. Vital after DIESEL tests.…$M=$(if,…)^ZAdvanced
^PMENUECHO toggleTurns macro echo off/on so the Command prompt stays clean.^C^C^P_.-LAYER;…;^PAdvanced
^QQuiet historyKeeps the macro's prompts and input out of the Command Line history.^C^C^Q_.REGENALL;Advanced
^]Select if neededPrompts the user to select objects only if nothing is preselected, and stores the selection as Previous (AutoCAD 2023+).^C^C^]_.CHPROP;_P;;_C;1;;Advanced
^RCommand versioningTurns command versioning on/off, so a macro written for an older release keeps its expected prompt sequence where supported.^C^C^R_.-HATCH;…Advanced
^MEnter (control)Same as ;, written as a control character._.ZOOM^M_E^MAdvanced
^ITabPresses Tab. Cycles Dynamic Input fields / object snap candidates.^IAdvanced
^HBackspacePresses Backspace.^HAdvanced
^BSnap toggleSnap on/off (Ctrl+B).^BAdvanced
^GGrid toggleGrid on/off (Ctrl+G).^GAdvanced
^OOrtho toggleOrtho on/off.^C^C^O_.LINE;Advanced
^DDynamic UCS toggleDynamic UCS on/off (Ctrl+D).^DAdvanced
^EIsoplaneCycles to the next isometric plane (Ctrl+E, Windows).^EAdvanced
^VNext viewportMakes the next viewport current (in macros; on the keyboard Ctrl+V is Paste).^VAdvanced
^TTablet toggleDigitizer tablet on/off (Windows only).^TLegacy
$M=DIESEL macroEvaluates everything after it as a DIESEL expression and feeds the result to AutoCAD._GRIDMODE;$M=$(-,1,$(getvar,gridmode))Advanced
$( , )DIESEL functionA DIESEL function call: $(name,arg,arg), commas only, no spaces.$(getvar,clayer)Advanced
( )AutoLISP expressionAnything in parentheses is evaluated as AutoLISP (full AutoCAD and LT 2024+).(setq sf 48)Advanced
!LISP variableReturns a LISP variable's value at any prompt._LTSCALE;!sf;Advanced
@Relative coordinateMeasures from the last point: @x,y or @dist<angle._.LINE;\@10<90;;Basic
#Absolute coordinateForces absolute coordinates when Dynamic Input defaults to relative._.MOVE;_L;;#0,0;\Advanced
<Polar angleSeparates distance and angle in polar input.@25<45Basic
,Coordinate separatorSeparates X,Y(,Z). In DIESEL it separates arguments.0,0Basic
/Path separatorUse forward slashes in file paths, because \ is a pause.C:/CAD/pole.dwgBasic
"String quotesDelimit text inside AutoLISP expressions. Plain macros don't use quotes.(command "_.ZOOM" "_E")Advanced
!.Check mark (label)In a classic menu label's DIESEL, returning !. shows a check mark.$(if,$(getvar,gridmode),!.)GridAdvanced
~Grey out (label)In a classic menu label, greys out (disables) the item.$(if,$(=,$(getvar,tilemode),1),~)MSPACEAdvanced
=*Show current menuDisplays the current top-level pull-down, shortcut, or image tile menu (Windows).$P0=*Legacy
$Px=Menu swapLegacy MNU menu-section loading/swapping.$P1=POP1Legacy
+Line continuationLegacy MNU files: a trailing + continues a macro on the next line. Not needed in CUIx.^C^C_.LINE;+Legacy

Common option keywords used in macros

KeywordMeansUsed with
_EExtentsZOOM
_WWorld / WindowUCS / ZOOM, selection
_M _S _NMake / Set / New-LAYER
_C _L _LWColor / Ltype / Lweight-LAYER
_F _T _LO _UFreeze / Thaw / Lock / Unlock-LAYER
_ON _OFFOn / Off-LAYER
_SISingle selectionAny Select objects prompt
_P _L _ALLPrevious / Last / AllSelect objects
_A _RAll / Regapps-PURGE
_Y _NYes / NoConfirmation prompts
_BE _EBegin / EndUNDO groups
_END _MID _CEN _INT _PER _NEA _NONObject snap overridesAny point prompt

Glossary

TermDefinition
CUI / CUIxCustomize User Interface editor / the XML-based file it saves (acad.cuix, partial and enterprise CUIx).
Partial CUIxAn extra CUIx loaded alongside the main one. The best way to share your macros without editing acad.cuix.
Enterprise CUIxA company-wide, usually read-only CUIx set in OPTIONS → Files.
Element IDThe unique ID of a CUI command (e.g. UD_OHPRI), used to reference it across the interface.
Command stringThe tool palette name for a macro.
AcceleratorA keyboard shortcut (e.g. Ctrl+Shift+P) assigned to a CUI command.
DIESELDirect Interpretively Evaluated String Expression Language: a tiny string language for logic in macros, labels and MODEMACRO.
MENUECHOSystem variable that controls whether macro input and prompts echo.
CMDECHOSystem variable that controls echo of commands run from AutoLISP.
FILEDIA0 = file prompts appear on the Command line instead of in dialogs (macro-friendly). Set it back to 1.
ATTREQ / ATTDIAWhether INSERT asks for attribute values / whether it uses a dialog to do so.
Macro AdvisorAutoCAD feature (2023 and later, so all of 2024–2026) that suggests macros from your command history (COMMANDMACROS, MACRONOTIFY, MACROINSIGHTSSUPPORT).

5 — Interactive Macro Builder

Build a macro step by step, or start from a preset. The macro string, a plain-English explanation and warnings update live. When it's right, copy it into the CUI / tool palette / Command Macros palette, or export it as a .lsp command, a .scr script, an instructions .txt, or a .json library you can share with your team.

✅ Every preset, warning and export uses syntax supported in AutoCAD 2024, 2025 and 2026 (and AutoCAD LT for Windows; LISP exports need LT 2024+).

Start from a preset

✎ Build

Name
Command name
Description
Add a step:

📋 Your Macro

Export for AutoCAD:
cancelcommandoptionvalueenterpausecontroltransparentDIESELLISP

🔍 Macro Decoder

Paste any macro from a CUI file, a forum post or a co-worker's palette and get every token explained in plain English. Click Load into Builder to edit it.

⭐ My Macro Library

Macros you save are kept in this browser. Export the library as .json to back it up or share it, and import a co-worker's library file to merge theirs into yours.

Using Your Exports in AutoCAD 2024, 2025 & 2026

ExportHow to use it
Copied macroCUI → Command List → New command → paste into Macro. Or paste into a tool palette tool's Command string, or COMMANDMACROS → Saved → right-click → Edit Macro.
.lspAPPLOAD → load the file (add it to the Startup Suite to auto-load), or add (load "C:/CAD/Lisp/file.lsp") to acaddoc.lsp. Then type the command name. Supports undo groups and works from keyboard shortcuts, even with pauses.
.scrType SCRIPT and pick the file, or drag the .scr onto the drawing. Scripts can't pause, so pause steps are left out with a comment.
.txtA reference sheet: the macro, its explanation, and step-by-step install instructions for documentation or CAD-standards manuals.
.jsonLibrary backup / team sharing. Import it on this page on any device.
📄 Want the reference side of this page in print? Download the Macro Guide PDF.
💡 Need loops, math, or reading data? Jump to the LISP Builder, LISP Snippets or LISP Scripts.