<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get Custom Ribbon Tab name safely in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12090959#M10863</link>
    <description>&lt;P&gt;This article shares code to read all ribbon panel titles safely:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2011/03/ribbon-panel-title-conflict.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2011/03/ribbon-panel-title-conflict.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Jul 2023 11:53:16 GMT</pubDate>
    <dc:creator>jeremy_tammik</dc:creator>
    <dc:date>2023-07-10T11:53:16Z</dc:date>
    <item>
      <title>Get Custom Ribbon Tab name safely</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12090752#M10862</link>
      <description>&lt;P&gt;Hi, I'm in the development process of a modular plugin solution where all the buttons are under the same&lt;BR /&gt;Ribbon tab but the construction of the Ribbon Panels under this common tab is being done for each module.&lt;BR /&gt;&lt;BR /&gt;Meaning a user may choose to have different combinations of function which I can't predict so naturally&lt;/P&gt;&lt;P&gt;the code assumes it has to create this common tab because the modules aren't "aware" of each other.&lt;BR /&gt;&lt;BR /&gt;The problem is, I can't find a way to check if the tab name is already exists, I can check for panels using:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;GetRibbonPanels&lt;/SPAN&gt;(&lt;A href="http://msdn2.microsoft.com/en-us/library/s1wwdcbf" target="_blank" rel="noopener"&gt;string&lt;/A&gt; &lt;SPAN class=""&gt;tabName&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;I was hoping that calling for panels in a tab which doesn't exists, will return nothing but it throws an exception...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TomBADV_0-1688983405418.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1238458i03A3BDE51E1B9C88/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TomBADV_0-1688983405418.png" alt="TomBADV_0-1688983405418.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried using same name to check if the .CreateRebbonTab() will just ignore it, but is also throws an exception...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TomBADV_1-1688983715194.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1238461i44BB04044A8BF24C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TomBADV_1-1688983715194.png" alt="TomBADV_1-1688983715194.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I could use try-catch statement but this is typically last resort and overall wrong approach in my opinion&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;            try
            {
                application.CreateRibbonTab("AdvTools");
            }
            catch(Exception)
            {
               //do nothing
            }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Are there any decent work-arounds for this situation ?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 10:16:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12090752#M10862</guid>
      <dc:creator>TomB.ADV</dc:creator>
      <dc:date>2023-07-10T10:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get Custom Ribbon Tab name safely</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12090959#M10863</link>
      <description>&lt;P&gt;This article shares code to read all ribbon panel titles safely:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2011/03/ribbon-panel-title-conflict.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2011/03/ribbon-panel-title-conflict.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 11:53:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12090959#M10863</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-07-10T11:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Get Custom Ribbon Tab name safely</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12090972#M10864</link>
      <description>&lt;P&gt;I see, so currently the only way to do this is using a private method which will iterate over all the tab names&lt;/P&gt;&lt;P&gt;and return an indicator if it is safe or not to call .CareateRibbonTab()&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 12:01:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12090972#M10864</guid>
      <dc:creator>TomB.ADV</dc:creator>
      <dc:date>2023-07-10T12:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Get Custom Ribbon Tab name safely</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12091090#M10865</link>
      <description>&lt;P&gt;Well, maybe not the only way, just one possibility. There may be others, and some may be better. Who knows?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 12:45:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12091090#M10865</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2023-07-10T12:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Get Custom Ribbon Tab name safely</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12091195#M10866</link>
      <description>&lt;P&gt;To create the &lt;STRONG&gt;RibbonTab&lt;/STRONG&gt; that's the way to do it, using a try, to guarantee that the &lt;STRONG&gt;RibbonTab&lt;/STRONG&gt; gonna be created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To create the &lt;STRONG&gt;RibbonPanel&lt;/STRONG&gt; you gonna need to search and maybe return the existent panel so you could add other buttons in the existent panel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using some extensions like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public static RibbonPanel CreateOrSelectRibbonPanel(this UIControlledApplication application, string tabName, string panelName)
{
    if (application.GetRibbonPanels(tabName).FirstOrDefault(p =&amp;gt; p.Name == panelName) is RibbonPanel ribbonPanel)
        return ribbonPanel;

    return application.CreateRibbonPanel(tabName, panelName);
}&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 10 Jul 2023 13:29:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/get-custom-ribbon-tab-name-safely/m-p/12091195#M10866</guid>
      <dc:creator>ricaun</dc:creator>
      <dc:date>2023-07-10T13:29:46Z</dc:date>
    </item>
  </channel>
</rss>

