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.
About Edwin Prakoso
I work as a Sr. Technical Consultant in Tech Data Advanced Solutions Indonesia. I’ve been using AutoCAD since R14 and Revit since Revit Building 9. I occasionally write for AUGIWorld magazine and also active in Autodesk discussion forum.
I’m an Autodesk Certified Professional (ACP) for Revit Architecture and AutoCAD. I’m also a member of Autodesk Expert Elite, appreciation for individuals who give contribution to Autodesk community.
Connect with me on twitter or LinkedIn