Sei sulla pagina 1di 32

Exploring AutoCAD CUI: introduction (1)

February 16, 2012 By Edwin Prakoso 0 Comments



There are many questions and confusion about customizing AutoCAD with CUI. Its
supposed to be simpler and easier than the old mnu or mns file. I never use the old way,
but I believe yes, its easier to do it graphically like this.
So lets discuss about customize user interface (or CUI). In this first article, we will
discus about accessing the dialog and preparing our own CUI that we will use later.
You can open the dialog by clicking the button in manage tab>customization>user
interface.

Or veteran users usually do it by typing CUI then [enter].
Customize User Interface dialog box
The dialog box probably looks a bit scary with all the commands, tree and graphics.
While it looks complicated, it is arranged logically. And should be easy to understand.

First, lets understand what are the three panes are for.
1. Customization tree
Customization tree is where you can arrange your commands, menu, toolbars, panels,
ribbon tabs, and other customization items.
If you click the + sign near an item, you will see sub items inside it. Lets try to expand
the ribbon.

Below the ribbon, there are tabs and panels. It also has contextual tab states: tab that will
open when you select objects.
This is the way we define where our commands, panels, tabs, toolbars and other elements.
Depends to which version of AutoCAD you have, you can see all CUIx files loaded to
AutoCAD. You can see it from customization files list dropdown or under the partial
customization files category.

Try to expand ACFUSION.
Under each customization file, you will see they have the same element: ribbon, tabs,
panels, and so on. If you expand the ribbon and panels, then you will see Inventor Fusion
panel.
Where does it appear? It appears at ribbon tab.

It is a good idea to create separate customization file and not messing the default
acad.cuix. We will do it later in this tutorial.
2. Command list
Command list is the area where you can find existing command, or create a new
command. Try to drag the slider on the right side of the command list. You should be
able to see all commands here.
You can filter the command by typing in search field, or choose list to display from
dropdown menu.

We will explore about creating new command on the next tutorial. If you only want to
create a custom panel without creating a custom command, you only need to find default
command here.
3. Properties pane
Select a command, then you should see the right pane (3) is updated. Now it shows this
command properties.
You can change the button image, the command name, and macro that will be executed
when you click the button. This is where you define the properties of commands, panels,
tabs, and other elements.
We will define a new command properties on the next tutorial, and use it to fine tune our
custom panel and tab on other tutorial.
Preparation
Before we start to make a customization, lets do some preparation. We will create a new
CUIx file to work on this tutorial series.
Create a custom CUIx
Lets create our own custom CUI. We will create commands, define panels and tab here.
We will not use AutoCAD default CUI.
To create a CUI file, go to transfer tab in CUI dialog. Click new button or choose new
from dropdown menu.

Click save to save it to a new CUIx file.
Load CUIx file
You have created the CUI file. But you havent load it yet. Go back to customize tab,
then click load partial customization file. Or you can right click when selecting partial
customization file, then choose it from contextual menu.

Find your saved customization file you saved in previous step, then load it. Now you
should see your file listed both in dropdown menu and under partial customization files.

We will continue to work with customization on the next tutorial.





Exploring AutoCAD CUI: Creating a
command in tab (part 2)


February 20, 2012 By Edwin Prakoso 4 Comments
In previous tutorial, we explore the CUI dialog interface and create our own
customization file. Lets go further.
Lets see what we will do:
1. We will use our own cui file. So create it first before you follow this tutorial. We
did it on the last tutorial.
2. We will create custom commands. Later, we will combine them with existing
AutoCAD command to our panel.
3. We will create a panel and a ribbon tab.
4. 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
Lets try to create a ribbon panel version of Paul Munfords 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 commands properties.
Configuring your command
Change the properties as shown below:

Here are some considerations:
1. You should give the command a unique name, so you can find it easily.
2. You need to define the macro that will be executed when this command is active.
3. Optionally, you may add information to description and other fields. You can also
define the icon image. You can create 3232 pixel image for large icon and
1616 pixel for small icon. Or just pick one from available icons.
You may create as many tools as you want. In Pauls article, you can find very useful
custom tools. Read it, you may find some custom tools that you want.
But remember, if its already a default AutoCAD command, you can just use it. You
dont 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 havent place it to a toolbar, menu or ribbon panel. AutoCAD doesnt know
where you want to place it. Yet. We must tell AutoCAD where it should be.
Were still working on our custom CUI file. For this exercise, lets 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 dont 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 its 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 dont 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.
1. Change the customization file to all customization files (1).
2. Select drafting & annotation default (2). You should see the right pane is now
showing the workspace contents (3).
3. In customization files tree, expand partial customization files> your customization
file> ribbon (4).
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 dont 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.
Isnt that cool? We will add more commands next, and how to arrange the commands in
our panel



Exploring AutoCAD CUI: working with
ribbon (part 3)

March 5, 2012 By Edwin Prakoso 0 Comments
We covered how you can create your own AutoCAD customization file and add your
own commands, panel and ribbon tab there. In this article, we will cover more details
about arranging our tools in a panel and tab by working with their properties. How to
make our panel looks as we expected.
We will add several more commands there, custom and AutoCAD default commands. If
you havent got any custom command, you can follow our previous tutorial or just
continue with default commands.
Adding custom commands
I created several commands from Paul Munfords macro like below. You can refer to
those macros or create your own if necessary.

Im too lazy to create proper icons for each command, so I just use default icons. Of
course, as you can see, the circular viewport is the same with draw circle icon. It can
confuse your team if you do this. In the real job, create custom icons for them!
Drag all the commands to our viewport panel. Arrange the sequence in logical order. I
arranged mine like below. The top to bottom commands will show in panel from left to
right.

You might want to click OK, close the CUI dialog to see the changes. The ribbon panel
should appears similar like below.

OK, the panel shows all command in one row, just like the old AutoCAD toolbar. This is
not right. We still have plenty of space above and below it. We will add more rows to
arrange them.
Working with rows
Open your CUI dialog again. We are still working with our own customization file.
Find your panel below ribbon category. Right click above your panel title, and choose
new row from context menu. This will create Row 2 below your panel.
Repeat the process to create Row 3.

Place all the rows above <SLIDEOUT>. We will discuss about slide out later in this
article.
Arranging commands in different rows
Now we have 3 rows in our panel. Drag and drop your commands to those rows. You can
place similar commands on the same row. Below is how I arrange my commands.

You can see on the right pane the preview of your ribbon panel now. It looks better, but
you can see that there are empty spaces at row 1 and 3. Its because they dont have the
same commands number on each row.

You can add more commands or move them to different row to make it looks neat. But
this time, lets adjust the appearance by change the command button width.
Adjusting command appearance
Lets change the viewport fit button. Select it under your panel tree.
Change button style to Small With Text. You can see at the panel preview now the button
is wider. But the text is too long, now its become longer than other rows.
Change display name to VPort Fit to make it shorter.
You may not see the changes immediately on preview panel. Change the button style to
other style, then choose small with text again.
Do the same thing with the last row. Now my custom panel looks like below. It looks
better, isnt it?

Add default AutoCAD commands
There are some default viewport commands we can add here. I consider to add this
viewport dropdown control. It will allow us to create different shapes of viewport, only
with one button.

To add this button, in CUI dialog switch to all customization files. This will allow you to
access all commands from all CUI files.
Change command filter to ribbon control elements. This action will filter the commands.
There are still many commands available. To control it further, type viewport in search
field.

Drag create viewports drop-down to your panel.
Working with Sub Panel
Here is the thing: the create viewport drop-down is the common command that we will
use often. So we want to make it standout from the crowd. We want to make it large. So
change the button style to large with text.
But wait! This doesnt look right. The large button should be on the left, using all three
rows height. The other commands should be on its right.

How to make it looks like this?

We need to separate the commands in a sub panel. A sub panel lets you to define the
placement just like in different panel.
Right click above Row 1 and choose New Sub-Panel from drop down menu. You should
see a sub panel is added, with one row. Add two more rows for the sub panel.
Move all custom commands from main panel rows to this sub panel. Leave the large
button on the main panel.
After the rows are empty, you can delete them.
The final arrangement should be like this:

So our all of our custom commands are now on the sub panel, and the create viewports
drop-down on main panel. You may want to play a little bit more by yourself about this
arrangement.
About slideout panel items
Do you notice the <SLIDEOUT> item in your panel? Do you know what its for?
Lets add one more row in main panel. Dont create it in sub panel. If you do it right, you
should see Row 2, not Row 4.
Add more viewport tools to that row. Choose any tools you want to.

Check the preview and close CUI dialog by clicking OK.
So what does the slide out do? You will see small arrow pointing down at your panel
name. Click it. Now you should see it slide out and show the second row!

This is useful if you have more tools to place at your panel, but rarely used.
You may want to try placing your custom panel at existing tabs. Or playing around with
more configurations. Feel free to do it. We created our own customization file, didnt we?
Next, we will cover about creating menu and toolbar. Yes, even the latest AutoCAD by
default using ribbon, many of us still use menu and toolbar!
How are you doing so far?





Exploring AutoCAD CUI: Working with
toolbar and menu (part 4)
March 12, 2012 By Edwin Prakoso 0 Comments
In the last tutorial, we learned how to place commands to ribbon. But we know that
ribbon is not everyones favorite. What if you want to add the commands to toolbar?
What if you want to add commands to menu? Lets see how we can do it here.
Working with toolbar
Working with toolbar should be easier. It has fewer properties than ribbon.
First, lets open our CUI dialog box. Remember to activate customization file to yours
(mine is cad-notes, yours might be different).
Creating new toolbar
Now we work on our own customization file. Try to click the + sign on the left of
toolbars category. You should see there is no item below it yet. Our customization file is
empty, remember?
Right click above toolbar, and choose new toolbar from contextual menu.

Give your toolbar name. I named mine my viewport tools. Not very catchy name, but at
least I know what tools are in it.
Placing commands to a toolbar
To place commands is easy. Switch to all customization files and expand partial
customization file. Expand your cui and expand toolbar.
Drag your commands to your custom toolbar. Very similar with ribbon, right?

After you finish placing commands, just click OK. You dont have to add toolbar to
workspace, even if you were working in ribbon interface. You should immediately see
the toolbar.
Loading toolbar
Just in case you dont see the toolbar, you can load it manually.
If you use ribbon interface, go to view tab, windows panel, toolbars> YOUR CUI>
YOUR TOOLBAR.

If you use classic interface, you can access it from menu tools> toolbars> YOUR CUI>
YOUR TOOLBAR.

As I said before, its very easy. Especially if you compare it to placing commands in
AutoCAD ribbon!
Working with menu
Working with menu is also the same. You create a new menu below menu category in
CUI file and drag your commands there.
There are things to consider, because menu is not as flat as toolbar. You can create sub
menu to group same commands with different options, and separator for similar
commands.
See the menu structure below. Viewport layers is a sub-menu. It contains several
commands.
To easily differentiate creating viewport and modifying viewport, we can add separator.
This is very logical, especially if you are already familiar with programming or
customization.

Now, how can we create the menu above in CUI?
1. Similar to toolbar, create new menu. Right click above menus category and
choose new menu from contextual menu.
2. Drag your commands below your menu.
3. Add new sub-menu if necessary and drag your group of commands there.
4. Add separator if necessary. You can arrange the sequence by dragging them in
CUI tree.

Arranging menu in workspace
Your new menu by default should appears as the last item. If you want it to appear
elsewhere, you have to move the sequence using CUI.
Open your CUI, choose to show all customization files. Expand workspaces and select
which workspace you want to arrange.
After you select the workspace, from the right pane expand menus. Drag your menu to
arrange the sequence.

Contextual menu
Do you like to choose commands from contextual menu? You can access it by right click
your mouse. We call it contextual menu because it will show only relevant commands
with your selection set.
Below is contextual menu for associative array.

If you dont have anything in selection set, then common tools you can get are navigation
tools.
We covered how to create contextual menu in the past, so if you are interested on how to
create it, you can read creating contextual menu tutorial here.
Exploring AutoCAD CUI: 5 more things
you can do with CUI (part 5)
March 21, 2012 By Edwin Prakoso 0 Comments
We have 4 articles already about working with CUI. Many people think that CUI is only
about creating custom commands, creating your own ribbon tab/panel or your own
toolbar and menu. There are more things you can do with CUI, and actually quite cool.
1. Rollover Tooltips and Quick Properties
Rollover tooltips and quick properties both give you quick information of your object.
Rollover tooltips will appear when you hover your mouse above an object. Quick
properties is a palette that will open when you double click an object. Or you can set it to
open automatically when you select object.
If you only want to see objects properties, rollover tooltip would be a logical choice. But
if you dont like to wait until it appears, you can just choose quick properties. But the real
difference is, you can edit the properties in quick properties but not in rollover tooltip.
Lets say you are a surveyor. You would like to get information of an object quickly, like
what is the object, its length and its area. You can just hover your mouse above it, and
dont have to inquiry its length and area! Isnt that cool?

If you want to have this on your tooltip, open CUI dialog. You can work with your own
customization file or just use default CUI.
Click rollover tooltips category.

You will see a list of objects at the right pane. If you use your own CUI, this list is still
empty. Click edit object type list to add objects to this list.

You will see a complete list of AutoCAD objects. Select all objects which you want to
modify the tooltip appearance. Lets say I want to customize polyline tooltip.
I click it and click OK. Now polyline is on the list. But it has an exclamation mark. It
means we havent defined any properties yet. So click all properties you want to show on
tooltip for this object.
I select layer, area and length here.

Click OK to accept your changes and close CUI. Now test it. Create a rectangle or
polyline and hover your mouse above it. Pretty cool right?
What about quick properties? You can do it the exact same way. But remember, you may
want to select properties you change regularly.

2. Keyboard Shortcuts
AutoCAD users probably use command alias as shortcut more than keyboard shortcut.
And many probably dont even realize this kind of shortcut exist.
There are common Windows shortcut we can use in AutoCAD. Like [ctrl] + A to select
all, [ctrl] + C to copyclip, and [ctrl] + V to pasteclip. Some AutoCAD users also use other
applications intensively. They probably prefer this kind of shortcuts than command alias.
But if you use AutoCAD as primary software, its more likely that you prefer command
alias.
If you open your CUI again, click shortcut keys under keyboard shortcuts.

You will see a list of complete shortcuts on the right pane.

If you select a command here, you will see the commands properties below that pane.
Find Key(s) below Access category here. Click button. After AutoCAD open a small
dialog box, press key combination that you want to assign.

Ok, what if I want to add commands thats not on the list? You can drag that command to
shortcut keys category.

It is a good thing to add it to your own customization file, so you will not mess default
AutoCAD CUI. And it would be easy to use it on other computer. You can simply load
your customization file!
3. Double Click Actions
Double click action is similar to right click menu. Its context sensitive. You can define
what command should be executed when you double click an object. Lynn Allen has a tip
on her blog before: convert a line to polyline with double click.
OK, lets just use Lynns tip to add this command to our CUI. Lynn uses AutoCAD
default CUI, so I guess I need to explain extra steps if you want to add it to your own
CUI.
1. Create a new command
You can create a new command to convert a line to polyline using macro below:
^C^CPEDIT;y;;
Create it on your own customization file.
2. Add double click action
Right click double click actions, and choose new double click action in context menu.
Select the action and change object name to LINE.

3. Add command to action
Now drag your command below this action. Youve done this several times, right?
It should look something like this:

Close your CUI and give it a try!
4. Mouse Click
Previously, when we work with our own customization file, it will override default
settings. For example, if you assign keyboard shortcut [ctrl] + A in your CUI, AutoCAD
will use it instead of select all as defined as default command.
I found that its different in mouse click. If you want to modify mouse click, you must
change it directly in acad.cuix. If you know how to add this to our own cui without
modifying acad cui, share in comment section below.
Heres a little explanation about mouse buttons. Common mouse we use is a 3 buttons
mouse. The left button is button 1, right button is button 2, and middle button is button 3.
See the structure below. You can also combined mouse click with [ctrl] and [shift] key.
ctrl + shift + click > button 2 means: you hold [ctrl] and [shift] key then right click your
mouse.

Like working with other actions, you can change the assignment by dragging command
here. Try to replace ctrl + shift + click button to with erase and see if it works!
Why there are so many buttons? If you have more than 3 buttons mouse, you can assign
commands to all of those buttons!
5. Loading LISP File
Another thing you can do with CUI is to load AutoLISP file. There are several ways to
load AutoLISP automatically. The other ways are you can use startup suite or acaddoc.lsp.
However, if you intend to deploy customization to use for all users in your company,
using CUI probably is the preferred way. You only need to load it once.
To load AutoLISP using CUI, right click above LISP files and choose load LISP from
context menu. Consider to create a default location so all users can have the same folder
in their computer. Otherwise, it will not work.

Do you use these custom setup in your
CUI?
So do you use them already? If you are familiar with customization, you probably already
do this. What is your favorite from these 5? If you havent which one do you think will
be useful for you, and what will you use it for? Share it here!

Potrebbero piacerti anche