So in my previous post, I went through the basics of the CUI editor, now I will run through the creation of a ribbon and populate that with panels and commands.
CUI file creation
In order to not disturb the main CUI file for AutoCAD and also make the customisations portable we will need to create our own file to contain the customisations.
To do this, go to the Transfer tab in the CUI editor and go to the right hand column and click on the icon next the drop down box that states “New File”.
This will bring up a windows file dialog. Browse to where you want to save this and remember where it was as we will need it for the next step.
Once you click OK you will be returned to the Transfer tab.
Now click on the customise tab and go to the drop down under “customisations in main file” and click open. Or you can click the folder icon next to this drop down (there is a third way to load files but I will run through that later).
This will open the blank CUI file that was created in the previous step.
Create a New Ribbon
Once you have your CUI open, make sure it is selected in the drop down rather than ACADLT.CUIX (or similar). Here it is called TEST.CUIX
The tree now displayed is everthing you can customise. There is a lot there! We will focus on the Ribbon section for now.
Click the plus next to the Ribbon and you will see TABS, PANELS and CONTEXTURAL TAB STATES listed. For now we are going to look at TABS and PANELS.
Right click on the word TAB and click “new tab”.
Once we have a panel we will be able to add them to the tab. Next up, right click on the word PANEL and click “new panel”.
I have called my panel, test panel. You will see that it has a launcher icon and an another icon called ROW 1. Under the rows is where you place your commands in order for them to show up on the ribbon.
There are three rows in the ribbon. If you need more the slideout is there to allow a larger panel. On my custom ribbon I have a slideout for lesser used layer commands that I sometimes use and find it hard to find in the other ribbon tabs.
Under each panel you can have sub-panels. This is a mini panel that has its own rows. This allows for large buttons and drop downs to be mixed with smaller buttons.
Lets add a new command. This is where scripting comes in. In the full version of AutoCAD you can call LISPs and write DIESEL commands straight into a button command (note that LISP and DIESEL are programming languages and will require knowledge of these to undertake).
However in LT you are limited to only MACROS. MACROS look complicated but are actually a representation of the command line inputs, just in one line.
You will notice that the command list is empty as this CUI file contains no commands.
In order to create one, click the little star to the right of the “All Commands Only” drop down.
I have called my command “test command”. Once created you will get a new properties box on the right with name, description etc. listed.
The main items to fill in are the name and the macro. This will create a button with a command built into it.
Here we are going to create a button that launches the plot dialog box.
The MACRO code for this (see my macro basics for an explanation):
Once the MACRO is inserted we will assign an icon so it can be seen easily.
Click on the small arrows on the properties and the button image selection box will be shown. You can assign images, create new ones etc. here.
You can also load an external file for the icon by clicking in the image box and then the three dots to the end of the box (see above image).
Here we are going to use the built in icon for plotting.
Making the Ribbon
Once you have completed the command. Drag the command from the command list to the ribbon panel row1 (see above). The command is now assigned to that panel.
Then drag the panel to the tab. The panel is now assigned to the tab.
Click Apply and then OK.
Your Ribbon should now appear at the end of the ribbon list.
If it doesn’t appear you can use the third method (mentioned earlier) of loading a CUI file. Type CUILOAD and a little box will appear.
Click your CUI file name and click “unload”. Now click “browse” and go where you cui was saved and then click “load”. Then click close. The ribbon should now work. I have found this works most of the time whilst loading within the CUI editor fails more often.
DO NOT click on the ACADLT one at the top and then click “unload”, this will break things horribly. If you do, you will need to browse to the ACADLT customisation file and load it again (this is usually stored under your profile in windows, for LT 2015 this is under “C:\Users\yourusername\AppData\Roaming\Autodesk\AutoCAD LT 2015\R21\enu\Support”