<?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 Hide ribbon tab if family document active in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/hide-ribbon-tab-if-family-document-active/m-p/8275558#M47531</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OBJECTIVE:&amp;nbsp;&lt;/STRONG&gt;To hide a external application (the tab in the ribbon) when a family document is open.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CONTEXT:&amp;nbsp;&lt;/STRONG&gt;I understand the XML&amp;nbsp;tag "NotVIsibleInFamily", but it seem to work just for external commands:&lt;/P&gt;&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2017/ENU/Revit-API/files/GUID-4FFDB03E-6936-417C-9772-8FC258A261F7-htm.html" target="_blank"&gt;https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2017/ENU/Revit-API/files/GUID-4FFDB03E-6936-417C-9772-8FC258A261F7-htm.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a nice day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Juan.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Sep 2018 13:48:59 GMT</pubDate>
    <dc:creator>juancalvoferrandiz</dc:creator>
    <dc:date>2018-09-18T13:48:59Z</dc:date>
    <item>
      <title>Hide ribbon tab if family document active</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/hide-ribbon-tab-if-family-document-active/m-p/8275558#M47531</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;OBJECTIVE:&amp;nbsp;&lt;/STRONG&gt;To hide a external application (the tab in the ribbon) when a family document is open.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;CONTEXT:&amp;nbsp;&lt;/STRONG&gt;I understand the XML&amp;nbsp;tag "NotVIsibleInFamily", but it seem to work just for external commands:&lt;/P&gt;&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2017/ENU/Revit-API/files/GUID-4FFDB03E-6936-417C-9772-8FC258A261F7-htm.html" target="_blank"&gt;https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2017/ENU/Revit-API/files/GUID-4FFDB03E-6936-417C-9772-8FC258A261F7-htm.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have a nice day.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Juan.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 13:48:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/hide-ribbon-tab-if-family-document-active/m-p/8275558#M47531</guid>
      <dc:creator>juancalvoferrandiz</dc:creator>
      <dc:date>2018-09-18T13:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: Hide ribbon tab if family document active</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/hide-ribbon-tab-if-family-document-active/m-p/8275642#M47532</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can add a reference to UIFramework.dll (it is in the same folder as RevitAPI.dll)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can control specific tab visibility:&lt;/P&gt;&lt;PRE&gt;var rc = RevitRibbonControl.RibbonControl;

var tab = rc.FindTab("&amp;lt;your tab name&amp;gt;");

tab?.IsVisible = false; // or true&lt;/PRE&gt;&lt;P&gt;It can be done in ViewActivated event handler, something like:&lt;/P&gt;&lt;PRE&gt;private void OnViewActivated(object sender, ViewActivatedEventArgs e)
        {&lt;BR /&gt;...
            tab.IsVisible = !e.Document.IsFamilyDocument;
        }&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Sep 2018 14:21:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/hide-ribbon-tab-if-family-document-active/m-p/8275642#M47532</guid>
      <dc:creator>aignatovich</dc:creator>
      <dc:date>2018-09-18T14:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Hide ribbon tab if family document active</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/hide-ribbon-tab-if-family-document-active/m-p/8287601#M47533</link>
      <description>&lt;P&gt;Ok. Thanks for your answer. At this moment I don't understand events as well as&amp;nbsp;I would like. When I have time to study them properly I will try your idea. Thanks again. Have a nice week.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Sep 2018 09:14:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/hide-ribbon-tab-if-family-document-active/m-p/8287601#M47533</guid>
      <dc:creator>juancalvoferrandiz</dc:creator>
      <dc:date>2018-09-24T09:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: Hide ribbon tab if family document active</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/hide-ribbon-tab-if-family-document-active/m-p/8292538#M47534</link>
      <description>&lt;P&gt;You could also consider implementing an IExternalCommandAvailability class.&amp;nbsp; This class can be assigned to a button an will allow you to "compute" whether the button should be enabled or not.&amp;nbsp; You could check for family document there and disable the buttons (instead of hiding the tab which can lead to user confusion).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your pushbutton data object you can set the availability class like this:&lt;/P&gt;&lt;P&gt;myCommandBtnData.AvailabilityClassName = "myNameSpace.myCommandAvailability";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the class looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    class myCommandAvailability : IExternalCommandAvailability
    {
        
        public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
        {
                if (applicationData.ActiveUIDocument.Document.IsFamilyDocument)
                      return false;
        }&lt;/PRE&gt;&lt;P&gt;If you want to get fancy, you can keep a reference to the button and change the text or tooltip to help the user understand why they command is disabled in a particular situation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Sep 2018 00:45:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/hide-ribbon-tab-if-family-document-active/m-p/8292538#M47534</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-26T00:45:09Z</dc:date>
    </item>
  </channel>
</rss>

