Help with revit API docs

How do i create a ribbon item class object… from what i see it has no public constructors

https://www.revitapidocs.com/2020/79225f03-1633-3722-15b0-752c91a3740d.htm

It looks like you can neither construct a RibbonItem nor RibbonItemData object. Instead, you have to use a more specific class, such as PushButtonData, which inherits everything from RibbonItemData e.g. RibbonPanel.AddItem(PushButtonData). This will add a PushButton to your RibbonPanel. Here is an example from Autodesk (written in C#, but straightforward enough).

1 Like

I’m curious, how would it work if you tried to create a ribbon using Dynamo and Python. Would it only last until the run ends (basically instantly) or would it actually install it?

I would expect it to stay in the UI for as long as the application is open, but if you close Revit and reopen it, it wouldn’t be there. However, I doubt the button would actually be able to function once it has run as you’re no longer actively subscribing to any events.