0

Is it possible to dynamically add commands after IExternalApplication.OnStartup has executed to Revit's Ribbon Panel?

I came across this post on TheBuildingCoder... http://thebuildingcoder.typepad.com/blog/2010/03/adding-noncommands-to-the-revit-ribbon.html

.. and the first "P.S." on there seems to imply that it's not possible, but that was back in 2010. I'm wondering if anything has changed?

I haven't been able to figure it out myself. Trying to just execute the AddPushButton() code that I've written results in: An unhandled exception of type System.Runtime.InteropServices.SEHException' occurred in RevitAPIUI.dll

It works fine when placed inside the IExternalApplication.OnStartup block, which seems to imply that I either need to execute the code to add to the Ribbon panel in some sort of Transaction pattern or similar... or, it's just not possible :(

Any help would be appreciated, thank you!

Muers
  • 3,190
  • 3
  • 26
  • 32

1 Answers1

0

I've been able to do this in the past (at least with Pulldown buttons, adding more of them later on).

During the OnStartup, I stored a static reference to the main PulldownButton, and then later on, call PulldownButton.AddPushButton() to add the additional buttons.

(I know- short on details, but I hope it helps!).

Matt
  • 1,043
  • 5
  • 8
  • Hmm... that sounds promising. I'll try something like that out. If you could provide any more detail I'd really appreciate it. Thanks so much! – Muers Jul 15 '14 at 22:18