In this Article...
Hai Le has shared some cool tips how to utilize macros in AutoCAD. He shows that customization doesn’t have to be complex.
Check some old tips he shared me before:
- Restore AutoCAD standard layers and styles.
- Automatic dimension spacing with double click.
- More macro tips to change UCS and text layer.
Macro is very useful, but you are limited to use it in CUI. You can access macro in toolbar, ribbon, double click or tool palettes. But if you want to use command line, then you have to use AutoLISP.
Just like macro, customization doesn’t have to be complex. Here are some secondary commands idea from Hai Le.
AutoCAD commands have many settings that you can change in command line when the command is running. If you often change setting when you use a particular command, it would be a good idea to create a secondary command. Below are two ideas that you can use as secondary commands.
O for OFFSET, OO for OFFSET to current layer
By default AutoCAD Offset command will create a result on the same layer as original object. You can change the layer to current layer by changing the parameter when offset command active. It would be faster if you type OO to create the result on current layer, isn’t it?
You certainly can use OC as the command. But the idea of secondary commands here is to have options for available commands quickly. It’s much faster to type OO than OC, right?
Check this first AutoLISP tutorial: Zoom to origin. The tutorial will give you an idea how you can create simple customization by creating a LISP program.
Similar as described in that tutorial, you can create similar program to make Offset to current layer with this code:
(defun c:OO (/ )
(command "_OFFSET" "L" "C")
You can create another LISP to create object on the same layer as source object like this:
(defun c:OOO (/ )
(command "_OFFSET" "L" "S")
Of course, you can use other command than OOO if you like.
M for MOVE, MM for MOVE previous selected objects
Another idea is to create a custom command to move previously selected objects. Here is the code:
(defun c:MM (/ )
(command "_MOVE" "P")
Instead of typing M enter then P enter, you can type MM then enter.
Do you have an idea about other secondary commands?
If you like the idea of creating secondary commands, you may have some ideas to create a command that you use often. Do you have an idea to share with us? Write in this comment section so other readers can read about it too!
We surely can learn something from you too.
And thanks to Hai Le for the cool idea!