Friday, November 1, 2013

Creating a context-sensitive Ribbon tab
One very common customization question we've been asked is how to make a context-sensitive Ribbon tab that offers useful tools when a polyline object is selected. AutoCAD Civil 3D developers have done a nice job with the context-sensitive Ribbon tabs for Civil 3D objects, but civil designers use polylines often. There should be a Ribbon tab....



Open the CUI. (Type CUI from the command prompt.)

Our opinion is that you should create a new Cuix file for your customizations, but this will also work if you build it right into the c3d.cuix. It just won't be as easy to move it up when you upgrade the software.

From the Customize User Interface dialog, find and activate the Transfer tab.













Hit the Save button on the far right of the dialog (we'll be working only on the right hand side until we go back to Customize tab) and save the new .cuix file somewhere you know where it is. I place mine in my user support folder, C:\Users\\AppData\Roaming\Autodesk\C3D 2014\enu\Support. That's where Civil 3D first looks for support files, so it will be found here. If you put it in a custom folder, be sure you update your support file search path.

Right-click where it says Workspaces and select Load File as Partial.




This will place a reference to the file in the Partial Customization Files section when you move back to the Customize tab. Move back to the Customize tab now.

Expand Partial Customization Files, find your newly added file (my example is called Tim) and expand it, expand the Ribbon collection. Right click Tabs, select New Tab. Give it a meaningful name like "Polyline Selected."

 
Change the tab's Default Display to Do not add to workspaces.
 
 
 

Right click Panels, select New Panel. Give the panel a new name, like Polyline Tools. Expand the new Panel and find Row 1.

 



 

In the Commands list find Create Feature Line from Objects. Drag-n-drop that command onto Row1 of your new Panel.

Continue by dragging-n-dropping Add to Surface as Breakline, Create from Polyline (this creates an alignment from polyline), Create from Objects (creates a parcel from objects). Add Polyline Edit to get the Pedit command.
 
To add a layer pulldown, change from Custom Commands to Ribbon Control Elements. Drag-n-drop Layer List Combo Box to your panel.
 
Continue adding tools until you're satisfied, unless you're the type of person who is never "satisfied". If that's the case, continue adding tools for ten minutes and then stop. It's good enough for now, especially if you're on the clock.
 
Drag-n-drop the new Panel up onto the new Tab.

Big step now, just below where you have been adding commands to panels, find and expand Contextual Tab States. Drag and drop your new tab (we called it Polyline Selected) onto the Polyline object. Also drag it onto Polyline 3D Selected.

For each command that you place on your panel, select the command on the row and then modify its properties to control a text label, orientation and button image.

Press ok all the way out. Select a polyline.





 





No comments: