Remove/hide native buttons using the REVIT API

Remove/hide native buttons using the REVIT API

Anonymous
Not applicable
1,579 Views
5 Replies
Message 1 of 6

Remove/hide native buttons using the REVIT API

Anonymous
Not applicable

Hi all,

 

Could you let me know if there is any way to remove/hide native buttons from Revit 2022 using the API provided?

 

I wish that in the "collaborate" tab I could hide the "Synchronize with central" button.

 

The intention is to extend the logic of this button by creating a new one.

 

I'm using .NET as a language to interact with the API...

 

Thanks.

0 Likes
Accepted solutions (1)
1,580 Views
5 Replies
Replies (5)
Message 2 of 6

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @Anonymous ,

Please try using this below sample code

 Autodesk.Windows.RibbonControl ribbon = Autodesk.Windows.ComponentManager.Ribbon;
                foreach (Autodesk.Windows.RibbonTab tab in ribbon.Tabs)
                {
                    if (tab.Title.Contains("Collaborate"))
                    {
                        foreach (Autodesk.Windows.RibbonPanel panel in tab.Panels)
                        {
                           
                          if(panel.Source.Id== "central_file_shr")
                          {
                              RibbonItemCollection collctn=panel.Source.Items;
                              foreach(Autodesk.Windows.RibbonItem ri in collctn)
                              {
                                 if(ri.AutomationName== "Synchronize with Central")
                                 {
                                        ri.IsVisible = false;
                                        ri.ShowText = false;
                                        ri.ShowImage = false;
                                 }
                              }
                          } 
                        }
                    }
                }

I hope this helps.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 6

Anonymous
Not applicable
Hi Naveen!

Your example worked correctly.

Thank you very much.

Best Regards,
Yuri Bezerra.
0 Likes
Message 4 of 6

RPTHOMAS108
Mentor
Mentor

You can probably override the built in command via command bindings, at least then the button would still be where people expect it.

 

Buttons not where they are expected to be, just very annoying. Makes you want to just unload all the add-ins to find the culprit. 

 

Like in the old days when your browser home page got changed by a website, what was that called again (something hijack)?

0 Likes
Message 5 of 6

jsnowHJVYV
Contributor
Contributor
what did you use to access the api for that

i tried "usingn Autodesk.UI.Windows;" and got nothing.
it wont recognize the code u have posted
0 Likes
Message 6 of 6

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @jsnowHJVYV ,

1)Add reference "AdWindows.dll" from "C:\Program Files\Autodesk\Revit 202x"
2)Add namespace "using Autodesk.Windows;" to the code
3)Now you should be able to access the RibbonControl.

I hope this helps.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes