Group My Own Commands in the Ribbon

Here is an issue that has been presented numerous times in the past, and apparently needs to be highlighted again for newbies.

Question: I have implemented a Revit add-in which implements several commands.

Currently, I have added all my commands to the add-in manifest file, as recommended by various examples I found on the Internet. It works and they do indeed appear in the Add-Ins ribbon tab under the 'External Tools' pull-down menu.

The problem with this is that other commands from other companies' add-ins appear in the same place and are mixed up with mine.

Is there some possibility to group my own commands somehow?

I would like to have my commands separated from the other companies' ones.

For example, is it possible to add a parent category for my commands in the 'External Tools' category, or to group them in some other way, for instance by creating a special ribbon category other than 'External Tools'?

Answer: Yes, there are several simple ways to group your commands separately.

You can define your own panel in the Add-Ins tab using the CreateRibbonPanel method. This is the recommended approach.

If you really want, you can also define your own ribbon tab. However, this is not recommended.

The former approach is demonstrated by many examples. For instance, I implemented an absolutely minimal separate add-in tab providing one single button to demonstrate enabling ribbon items in zero document state.

The structural concrete setout point add-in is very slightly more complex, providing two buttons :-)

The ADN training material on the Revit UI includes an entire class on the topic of ribbon customisation which covers almost every possibility provided for creating your own ribbon items. You can either look at the Xtra version (recently updated) or the standard material from the Revit Developer Center.

Read the documentation explaining the ribbon UI exercise, "Revit Ui Lab1 - Ribbon.doc", provided separately for C# and VB in the subdirectories DocsCS and DocsVB of the 2_Revit_UI_API folder.

Sample source code is also provided separately for both C# and VB, respectively:

Read-Only Parameter Workaround

To add a little hint for more advanced Revit API users, another frequently asked question has to do with read-only parameters.

Developers would often like to add parameters that cannot be modified to a family definition. However, the Revit API currently does not provide any support for creating read-only parameters, unfortunately.

One way to make a parameter a little bit harder to modify anyway is to define its value via a formula instead of setting the value directly:

  FamilyParameter p 
    = famMgr.get_Parameter( name );

  if( null == p )
    p = famMgr.AddParameter( name, 
      ParameterType.Text, false );
  if( p.StorageType 
    == StorageType.String )
    if( '\"' != val[0] )
      val = "\"" + val + "\"";
    famMgr.SetFormula( p, val );