Sei sulla pagina 1di 4

Tutorial: Create a custom command

http://www.ellenfinkelstein.com/acadblog/tutorial-create-a-custom-command/

Tutorial: Create a custom workspace in AutoCAD 2006 and later

How to stay up to date with AutoCAD

If you find yourself using the same combination of commands and options over and over, you can easily create a custom command that executes the combination with a click of a button or a menu item. In this tutorial, I explain the basics of AutoCADs menu syntax so that you can create your own commands. No programming required!

1
tweet

retweet

1. Enter cui at the command line/dynamic tooltip to open the Customize User Interface dialog box. 2. In the Command List pane, click New (Create a New Command). 3. In the Properties pane, enter a name for the command in the Name text box. Also enter a description in the Description text box. 4. If you think your command will be long or need more than one line, click in the Macro text box and then click the Ellipsis button that appears on the right. Then enter your macro in the Long String Editor dialog box. Otherwise, enter the macro in the Macro text box. Start by writing out the combination of commands and options as you would enter them on the command line or in a script. Then add any necessary special characters. Below are the special characters you need to know for menu macros: Character Space Description Equivalent to pressing Enter except when entering text to create a text object that contains spaces (between words). Use between the command and its options. Equivalent to pressing Enter. The end of a line in a menu macro is also equivalent to pressing Enter. More helpful than using a space when you need to press Enter twice, because it shows the number of Enters more clearly. Also helpful at the end of the macro. Pauses for user input, such as picking a point or entering a value. At the end of a macro line, continues the macro to the next line At the beginning of a macro, before ^C^C, repeats the macro until you press Esc or choose another menu item. Toggles the display of the menu macro on the command line; makes the macro look neater when you use it.

; (semi-colon)

\ +

^P

1 of 4

11/10/2011 1:39 PM

Tutorial: Create a custom command

http://www.ellenfinkelstein.com/acadblog/tutorial-create-a-custom-command/

1. From the Command List Categories drop-down list, choose Custom Commands to easily find your command. Select it and drag it to the desired menu or toolbar at the top of the Customize User Interface dialog box. 2. If you drag it to a toolbar, use the Button Editor to give it an image. Usually, you choose an existing button to start with, click Edit, and modify it. Then click the Save As button to save the icon image. 3. Click OK and try out your new command! Related posts: 1. 2. 3. 4. 5. Creating Custom Toolbar Buttons Tutorial: Create a custom simple linetype Create a custom toolbar in AutoCAD 2006 or later Tutorial: Create a custom visual style in AutoCAD Ending the LINE command quickly

February 3rd, 2008 | Tags: command, commands, interface | Category: Customization

MORE Dropbox Space Get 250M in EXTRA storage space when you join Dropbox. It's free!

dropbox.com myArchicad.com/freeDownloa

Free 3D CAD for Architect ArchiCAD 15 3D modeling tool for architects & interior designers!

MachineWorks The leading Software Toolkit For CNC Simulation And Verification www.machineworks.com

7 comments to Tutorial: Create a custom command


Create a custom keyboard shortcut AutoCAD Tips Blog
July 4th, 2011 at 4:16 pm

2 of 4

11/10/2011 1:39 PM

Tutorial: Create a custom command

http://www.ellenfinkelstein.com/acadblog/tutorial-create-a-custom-command/

[...] For information on how to create a custom command, see this tip. What keyboard shortcuts do you use? Leave a comment! Please also explain what they do, in case it [...]

Adel Moldovan
July 30th, 2011 at 4:44 am Hi, How can I change the default behavior of Multiple Object Stretch command? Meaning: when I press the MOS command and hit enter or right click mouse button it executes defaults Crossing Window selection, but wish to go for a Crossing Polygon option. Its annoying to keep entering CP or press down arrow keyboard button to select it over and over again since the CP option is the option I use most of the time. Its Acad 2012 Thx.

Ellen
July 30th, 2011 at 11:25 am Are you just talking about the STRETCH command? Ive never heard the phrase Multiple Object Stretch, although of course, you can stretch multiple objects with the STRETCH command. I would simply create a custom command and assign it to a keyboard shortcut or add it as a button to a ribbon panel. I have instructions here: http://www.ellenfinkelstein.com/acadblog/tutorial-create-a-customcommand/. This might also help http://www.ellenfinkelstein.com /AutoCAD_tips_create_custom_toolbar_cui.html although it describes adding a button to a toolbar, rather than to the ribbon.

Adel Moldovan
July 31st, 2011 at 3:45 am Dear Ellen, Thank for your quick replay. Yes, I meant the STRETCH command. Multiple Object Stretch is the tool tip displayed when you hover your mouse over the icon in Modify panel of the Express Tools tab. Also known as Stretch Multiple. Sorry for misunderstanding. The reason i look to edit or modify existing commands is that Im not very familiar with writing codes and programing and I find it easier to change just a bit of the existing code rather then write a new one. See, when I open the CUI and look for Multiple Object Stretch, macro label shows ^C^Cmstretch. Here I thought I can change that default behavior. And the STRETCH command shows $M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_stretch,^C^C_stretch) so I dont have a clue about where is the option of choosing Crossing Window or Crossing Polygon hidden. Or to make it simpler, if you type MSTRETCH the command line shows: Specify an option [CP/C] This is what I meant. It goes for C by default and I want to make CP to be default, not to type CP every time. When I wrote my question to you, i was already on http://www.ellenfinkelstein.com/acadblog/tutorial-createa-custom-command/ so now Ill give it a try with creating a custom command. Anyhow, thank you for your time.

3 of 4

11/10/2011 1:39 PM

Tutorial: Create a custom command

http://www.ellenfinkelstein.com/acadblog/tutorial-create-a-custom-command/

Adel Moldovan
July 31st, 2011 at 5:08 am Solved. Not exactly what I want but does the trick and its fast enough. After MSTRETCH long mouse right click and pick CP on a shortcut drop down menu. Good

sadegh
August 25th, 2011 at 7:06 am hi. cool tutorial. i learn it but i have a question. i make a new command and put it into one pallet but when i type it in command line, it dosnt run anything. is that normal? i like to create some custome command that i can type them in command line.is there any way!? (maybe i should use acad.pgp!) thanks

Ellen
August 25th, 2011 at 10:53 am You cant exactly type the command, but you can create a custom keyboard shortcut, such as Shift+L. I have instructions at http://www.ellenfinkelstein.com/acadblog/create-a-customkeyboard-shortcut/.

4 of 4

11/10/2011 1:39 PM

Potrebbero piacerti anche