0

I've developed a plugin for AutoCAD that involves cascading drop-down menus and am wanting to do the same in Revit, however the task is much more difficult in Revit than in AutoCAD due to the lack of CUI files and such.

I am working with the ribbon to see if I could do the same thing there and have been playing with SplitButtons, PulldownButtons, and Pushbuttons and have discovered a couple of things.

Before that, an image of what I want to get done is here:

The Electrical PulldownButton contains yet another PulldownButton called Wire. I want to have several layers for this whether it be using Pulldowns or SplitButtons.

What I've discovered when programming in C# with the Revit API is that SplitButtons and PulldownButtons can't add instances of itself, just PushButtons! Which confuses me because they were able to do it in the picture above.

edit:attached here is a picture of a cascading menu in Revit.. I was told this was possible but fairly difficult to implement.

user3026715
  • 404
  • 3
  • 5
  • 19

2 Answers2

2

I totally agree with Augusto. This is unsupported and undocumented territory. The Building Coder demonstrates some examples of using the unsupported functionality functionality provided by AdWindows.dll in the 'Automation' category or posts:

http://thebuildingcoder.typepad.com/blog/automation

One specific example of adding quite a lot of menu items arranged in a two- or three-level hierarchy is provided by the RvtSamples external application included in the Revit SDK.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17
0

You're probably looking for a sample like this:

public void AddSplitButton(RibbonPanel panel)
{
  // Create three push buttons for split button drop down 

  // #1 
  PushButtonData pushButtonData1 = new PushButtonData("SplitCommandData", "Command Data", _introLabPath, _introLabName + ".CommandData");
  pushButtonData1.LargeImage = NewBitmapImage("ImgHelloWorld.png");

  // #2 
  PushButtonData pushButtonData2 = new PushButtonData("SplitDbElement", "DB Element", _introLabPath, _introLabName + ".DBElement");
  pushButtonData2.LargeImage = NewBitmapImage("ImgHelloWorld.png");

  // #3 
  PushButtonData pushButtonData3 = new PushButtonData("SplitElementFiltering", "ElementFiltering", _introLabPath, _introLabName + ".ElementFiltering");
  pushButtonData3.LargeImage = NewBitmapImage("ImgHelloWorld.png");

  // Make a split button now 
  SplitButtonData splitBtnData = new SplitButtonData("SplitButton", "Split Button");
  SplitButton splitBtn = panel.AddItem(splitBtnData) as SplitButton;
  splitBtn.AddPushButton(pushButtonData1);
  splitBtn.AddPushButton(pushButtonData2);
  splitBtn.AddPushButton(pushButtonData3);
}
Augusto Goncalves
  • 8,493
  • 2
  • 17
  • 44
  • Hey Augusto, thanks for replying. However, this is not what I am looking for. I already know how to add PushButtons to a SplitButton. What I'm looking for is adding SplitButtons to another SplitButton. like the example I showed above where under the Electrical tab, there is Wire and Device that can drop down even further. – user3026715 Apr 05 '16 at 18:42
  • Actually that will happen when a full panel collapse due a small screen (or when you resize the Revit main window) – Augusto Goncalves Apr 05 '16 at 18:54
  • Oh. :( So then I assume it's not possible then? – user3026715 Apr 05 '16 at 19:03
  • I'm afraid it's not possible. The Revit Ribbon uses AdWindows.dll but maps all the object on it's own API, so many features are there, but not easily exposed. If you use AdWindows.dll directly, then you're on unsupported/undocumented territory :-( – Augusto Goncalves Apr 05 '16 at 20:31