By Joe Ye
Some customized Ribbon buttons are designed only for specific Revit product flavor. For example, button A is designed only for Revit Structure. It should be hidden in Revit MEP or Revit Architecture. One way is through the setting in the plugin loading config file, *.addin. VisibilityMode tag controls the visibility in the three Revit product flavors.
To show a button only in Revit Structure, you can use the following setting. Please note the bold and italics line.
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>C:\Program Files\Autodesk\Revit Structure 2013\Program\SomeAddin2013.dll</Assembly>
<ClientId>d796aae2-ab10-4e7b-bba9-e8ed56276ad6</ClientId>
<FullClassName>Revit.A</FullClassName>
<VendorId>Vendor</VendorId>
<Text>Some Text</Text>
<TooltipImage>C:\Program Files\Autodesk\Revit Structure 2013\Program\\SomePictureLarge.png</TooltipImage>
<LargeImage>C:\Program Files\Autodesk\Revit Structure 2013\Program\\SomePictureLarge.png</LargeImage>
<SmallImage>C:\Program Files\Autodesk\Revit Structure 2013\Program\\SomePicture.png</SmallImage>
<Description>Some addin for Revit 2013</Description>
<VisibilityMode>NotVisibleInFamily|NotvisibleInArchitecture|
NotVisibleInMEP</VisibilityMode>
<VisibilityMode>NotVisibleWhenNoActiveDocument</VisibilityMode>
<Discipline>Structure</Discipline>
</AddIn>
</RevitAddIns>
Here is the description of VisibilityMode tag, which is excerpted from the Revit API Developer Guide.pdf document.
The modes in which the external command will be visible.Multiple values may be set for this option. Optional; use this tag for ExternalCommands only.
The default is to display the command in all modes and disciplines, including when there is no active document. Previously written external commands which need to run against the active document should either be modified to ensure that the code deals with invocation of the command when there is no active document, or apply the NotVisibleWhenNoActiveDocument mode. See table below for more information.
All the optional values for tag VisibilityMode is as follow. These values can be united by “|” operator.
AlwaysVisible
The command is available in all possible modes supported by the Revit API.
NotVisibleInProject
The command is invisible when there is a project document active.
NotVisibleInFamily
The command is invisible when there is a family document active.
NotVisibleWhenNoActiveDocument
The command is invisible when there is no active document.
NotVisibleInArchitecture
The command is invisible in Autodesk Revit Architecture.
NotVisibleInStructure
The command is invisible in Autodesk Revit Structure.
NotVisibleInMechanical
The command is invisible when the Mechanical discipline editing tools are available, e.g. in Autodesk Revit MEP.
NotVisibleInElectrical
The command is invisible when the Electrical discipline editing tools are available, e.g. in Autodesk Revit MEP.
NotVisibleInPlumbing
The command is invisible when the Plumbing discipline editing tools are available, e.g. in Autodesk Revit MEP.
NotVisibleInMEP
The command is invisible in Autodesk Revit MEP.