简体   繁体   中英

Dynamically add command after IExternalApplication.OnStartup to the Revit Ribbon?

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 "PS" 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!

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!).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM