Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Deal with duplicate ribbon panel names

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
george.potts
436 Views, 5 Replies

Deal with duplicate ribbon panel names

Hi all!

I have a ribbon panel editor to show/hide ribbon tabs within an in-house addin, we have lots of other paid tools and the ribbon is really ful. I noticed I'd have duplicate version for the family based panels in a regular window.

georgepotts_0-1684490414827.png

To remove the duplicates I did:

if (!ribbonCheckboxList.Items.Contains(tab.Title))
{
     ribbonCheckboxList.Items.Add(tab.Title);
}

When this list is built, the duplicates are removed, however the effect is present on both with the same name, as I do the following:

 

string CurrentlySelectedTab = (string)ribbonCheckboxList.Items[e.Index];
                if (sdsstring != CurrentlySelectedTab.ToLower())
                {
                    foreach (RibbonTab tab in Autodesk.Windows.ComponentManager.Ribbon.Tabs)
                    {
                        Debug.WriteLine(tab.Title);
                        if ((CurrentlySelectedTab == tab.Title) && (e.CurrentValue == CheckState.Checked))
                        {
                            tab.IsVisible = false;
                        }

                        if ((CurrentlySelectedTab == tab.Title) && (e.CurrentValue == CheckState.Unchecked))
                        {
                            tab.IsVisible = true;
                        }
                    }
                }

 

A simple on or off when clicked and everything works.
Now as it searches for Title, both panels are added or removed, resulting in this, duplicate versions. This is my error I'd like to fix:

georgepotts_1-1684490536380.png

Is there a way of detecting the family versions of the panels or should I be storing the tab.UID property instead? Obviously this would assume the first iteration of the "Annotate" panel is the "normal" one correct? I'd prefer to have a detection for family based as this would require it working in the family version as well.

5 REPLIES 5
Message 2 of 6

I do not know if there is an answer to this besides making your in-house custom panel names unique. You could prepend your company initials or in some other way?

Message 3 of 6

The duplicates are of official autodesk ribbon tabs, except they are the ones that appear when in a family model. They are normally hidden based on the type of model open, however as I am searching by Title property, the issue of these becoming duplicates occours. Its doesn't have anything to do with the number of addins.

I think I might build a test version with the UID property, export to JSON to read back and fourth from.

 

If anyone else has any better ideas do comment them!

Message 4 of 6
ricaun
in reply to: george.potts

You should use the Id, I'm pretty sure the Id is different for each RibbonTab. And the Title could change depending on the Revit language.

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 5 of 6

One last question, you obviously researched a lot here. Does tab have an id property that could be used?

Message 6 of 6
george.potts
in reply to: ricaun

georgepotts_0-1684508015673.png

Looks like thats the one thank you!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report