Keep Ribbon Tab active, untoggle Panels from Ribbon

Hello PyRevit Cummunity :slight_smile:

I already used python to hide and unhide ribbonTabs, now i have questions for further maipulation of Tabs and Panels.

First, I would like to make a button to keep the current Tab active. Revit changes to the modify tab as soon as i select a model element, i want to prevent that behavior. Is this possible?

Second, i would like to untoggle all panels of a ribbon at once. Doable with the API or not?

After using the dynamo player for 2 years i am searching for a good method to use my new pyRevit tabs and keep them in foreground.

Happy about any advice!
Kind regards :slight_smile:

As far as I’m aware there is no built-in way to prevent Revit from switching to the modify tab. However, it may be possible to create a workaround. But, it would be difficult to implement what I have in mind and I would not recommend it either.

As for toggling panels of a ribbon. It should possible to disable the tabs/panels/buttons of anything in the ribbon through the AdWindows.dll. However, I’m not sure if such a use case is officially supported. I’ve done something similar that will hide and disable one of my tabs when I’m not in a FamilyDocument.

1 Like

In the latest Revit lookup from yesterday there is an access to the dll that managed the UI if u read it properly. You could dig into that


I’ve done something similar via the AdWindows.dll as Nicholas mentioned, in combination with some event listeners to trigger the tab activation.

from pyrevit import clr
import Autodesk.Windows as adWin
ribbon =  adWin.ComponentManager.Ribbon
ribbon.FindTab('Collaborate').IsActive = True


If you going to import AdWindows why bother importing clr from pyrevit and adding the reference? Just import it straight from pyrevit.

from pyrevit.api import AdWindows as adWin

Because that would be too easy! Haha yeah my knowledge when it comes to imports and references is a little cobbled together if I’m being honest. That is a much better way, thanks for sharing.

1 Like

I installed Revit Lookup today for the first time and was excited to test it. Lost 2 hours of work because revit lookup gives me only one thing, a fatal error :confused:

you are unlucky, I uninstalled the previous version and installed the latest from 2 days ago and it worked like a charm with so many improvements.
You may want to file an issue report on their github accompanied with your revit journal file that will show the devs a bit more what is happening that makes it crashing

regarding your first question, isn’t it what you are trying to achieve?

1 Like

Oh, yes! Thank you @Jean-Marc i didn´t know that. Would be great if we could controle that with the API but I´m afraid it´s not possible. So maybe working with an untoggled panel will be the better solution…

I opened an issue on Github for Lookup.