In previous tutorial, we explore the CUI dialog interface and create our own customization file. Let’s go further.
Let’s see what we will do:
- We will use our own cui file. So create it first before you follow this tutorial. We did it on the last tutorial.
- We will create custom commands. Later, we will combine them with existing AutoCAD command to our panel.
- We will create a panel and a ribbon tab.
- We will define in which workspace the panel should appear.
Change your active customization file
In your CUI dialog, select your custom CUI you created before. If you miss the first step, you can check it in this first tutorial. I named it CAD-NOTES, but you may use your own name.
You should see your cuix file here. The command list is still empty, and there is no toolbar, menu or ribbon defined yet.
Create a new command
Let’s try to create a ribbon panel version of Paul Munford’s killer macro. There are few default AutoCAD command, but we also need to create the commands. So I guess this is a good exercise.
First, we need to create a command. In command list area, click create a new command.
Now you should see a command is listed here. The default name is Command1. Notice that the source is CAD-NOTES. It means the command is defined in that file. Select it.
The properties on the right pane is now showing the command’s properties.
Configuring your command
Change the properties as shown below:
Here are some considerations:
- You should give the command a unique name, so you can find it easily.
- You need to define the macro that will be executed when this command is active.
- Optionally, you may add information to description and other fields. You can also define the icon image. You can create 32×32 pixel image for large icon and 16×16 pixel for small icon. Or just pick one from available icons.
You may create as many tools as you want. In Paul’s article, you can find very useful custom tools. Read it, you may find some custom tools that you want.
But remember, if it’s already a default AutoCAD command, you can just use it. You don’t need to create a new one.
Placing your command
You already have your custom command. You can define it to execute macro like we did above, or run an AutoLISP program.
But you haven’t place it to a toolbar, menu or ribbon panel. AutoCAD doesn’t know where you want to place it. Yet. We must tell AutoCAD where it should be.
We’re still working on our custom CUI file. For this exercise, let’s work with ribbon. You may try to place it on menu or toolbar later, but this time just ribbon.
Where do you can find a command? In a ribbon panel. So now we must create a ribbon panel for our command.
Remember: If you decide to add this command to existing panel, you don’t need to create a new one.
Creating a panel
In customization tree, expand ribbon. You will see panels category there, but there is no panel defined yet. Remember, we are working on a new customization file.
Right click above the panels category and choose new panel from contextual menu.
Give your panel a name. I named mine viewport tools.
Now we have a panel, but it’s still empty. How can I add my command to this panel? By drag it from command list and drop it under the panel.
We will fine tune the appearance later. Just drag your command there now.
Creating a ribbon tab
Now AutoCAD knows on which panel the command should appear. But where the panel should be? Is it at home tab? annotation tab? We also need to define this.
Because we want to place all of our custom command to a separate tab, we need to create a new ribbon tab. Again, if you just want to add that panel to existing tab, you don’t have to create a new tab.
Right click above tab category, then choose new tab from context menu. Give the new tab a name.
Because we want our panel before to appear on this tab, drag that panel here.
The last thing: Define the workspace
Are we done yet? Unfortunately no. There is one last thing we have to define. In which workspace it should appear.
Follow these steps to place our tab to workspace ribbon.
- Change the customization file to ‘all customization files’ (1).
- Select drafting & annotation default (2). You should see the right pane is now showing the workspace contents (3).
- In customization files tree, expand partial customization files> your customization file> ribbon (4).
- Find your custom tab then drag it to ribbon tabs category.
We are done! Click OK to accept all changes and close CUI dialog.
You should see your tab now. Click that tab to activate it. Your panel and command is now there!
If you don’t see it, make sure you use drafting and annotation workspace! You can change it from quick access toolbar.
Try the command to make sure it works.
Isn’t that cool? We will add more commands next, and how to arrange the commands in our panel.
hello, i’m learning autocad arch and having a problem orienting 3d block to workspace. I found code for customizing command to use with netload but having trouble with finding a tutorial for implementing such a thing from start to finish for the first time. any help much appreciated
I wanted to load my “arg” file. however after I used “options” command, the screen doesnot load anything. I used a command before, but I forgot that command I used, it was similar to “appload”……but it’s not, Can you tell me what that command could be?
Are you looking for MENULOAD command?
Great tutorials. I have created a partial CUIx and a custom command (in 2015 LT) but I would like to add it to an existing panel. Can you tell me how to do that. I don’t want an extra ribbon or panel.
Are there any ways to activate these commands using the keyboard similarly to how i would press ”c” for ”circle”?
What you described is alias command. Certainly you can assign alias commands to your preference. Use command alias editor or edit acad.pgp directly.
Read about it here: Where Can I See AutoCAD Command Alias List?
I crated a command and named it UZ.. I added it to a new menu and it works fine from there. But when I try to type “UZ” I have a message “Unknown command”.
How to make it work from the command line?
You can’t use command line to load custom command in CUI. If you want to use command line, you need to create custom command using LISP.
Hi there,i get as far as creating a new command but the command list is already full of many commands,are these just default commands and you`re just adding a few new user friendly tabs/panels?.Im using ACAD2011
I use my own customization file (CUI). I explain it at the first paragraph. You can follow the previous tutorial to create it.
Thanks Edwin,i was missing the `Load` screen,good stuff,
Thanks ! Great info!