8. January 2010 13:30
As anyone who tried the Christmas ribbon solution would have found, it lacked one feature. The ability to handle context switching between standard projects and families. Changing to the other project type would cause the custom ribbon tab to disappear. There are a number of approaches to handling this context switching.
Brian left a comment on the original post and others contacted me privately to highlight the problem and ask how it can be solved. To make it easier for people I’ve updated the RibbonService class to automatically handle the context switching as per standard behaviour. Hopefully this will also help those coding a more customised solution.
Using the updated RibbonService requires one additional line to bind Revit’s ControlledApplication object to the RibbonService as follows:
public IExternalApplication.Result OnStartup(ControlledApplication application)
// Create User tab and get a revit panel
RibbonService.BindControlledApplication(application);// additional line required
var tab = RibbonService.CreateTab("RED_ID", "Merry Christmas", true);
var panel = RibbonService.CreatePanel(tab, "Presents");
Note I updated the namespaces so you’ll have to update your Revit.ini accordingly.Source and binary can be downloaded here . Enjoy!!