Using It! - Adding Custom Icons to your tools

When you create custom tool buttons to add to the Ribbon or Quick Access Toolbar existing icons from the application may be appropriate or you may wish to create your own. Sometimes there may be an existing icon whose pattern is appropriate to follow for a custom tool. One case that recently came up was the absence of a button to show hidden cached elements.

In a cached Drawing View right-clicking elements offers the Hide and Hide/Copy options which enable some manipulation of the application's output:

While any hidden elements can be revealed by the key-in REFERENCE VISIBLEEDGES CACHED HIDDENTOGGLE there isn't a ribbon button to do this so I'm going to add one to do this:

Sometimes a new icon needs to be created, but in this case I want a variation of the existing icons shown above.

The steps are:

  1. Export an existing icon as a pattern for the new one
  2. Edit the icon
  3. Create a new Ribbon Button and add the icon

Exporting Icons from RSC to ICO

Most Bentley icons are stored in RSC files that cannot be read by third-party image editors, ustnicon.rsc for instance which contains the majority of MicroStation's icons. Therefore one of these should be exported out to an ICO file for editing. The sources of icons are listed in the Define Icon for Tool dialog; note the other application RSC files listed in the drop down and the Import Selected Icons option that we will come back to later:

Right-click on the Ribbon and pick Customize Ribbon, in the Customize Ribbon dialog pick Custom Tools and Tasks (1), click the Icons tab (2) then From Mdl Resources... (3)

Browse to ustnicons.rsc:

Find the HideElementInCVE icon, highlight it and click OK:

Any selected icons will then be imported into the active DGN appearing in the Customize dialog:

To export them key-in: customize export icons <folderPath>

the icons will then be available as individual ICO files for editing.

Editing Icons

I use Greenfish Editor Pro, a freeware dedicated icon editor that is appropriately featured and simple enough for occasional use. Just save the existing icon with a new name (1):

Delete all of the images except the highest resolution 32 x 32 @32-bit, edit the icon graphics then right-click and use the 'Create Windows icon from image' utility (2) to generate the smaller icon images:

Creating the new tool

Open the DGNLIB where the tool should be stored, in this example it's C:\Users\Marc.Thomas\AppData\Local\Bentley\OpenBuildingsDesigner\10.0.0\prefs\Personal.OpenBuildingsDesigner.dgnlib

In the Customize Ribbon dialog navigate to the place where the new tool is going to be (1), enter the Label, Description and Key-in (2), click the '...' button to the right of Icon Name (3) 

select the Import Selected Icons option (4) and browse to the new ICO file:

Click Apply and the new button will appear in the Ribbon (5).


I did eventually find the existing icon for this function: