IExternalCommandAvailability Interface


IExternal Command Availability Interface

An interface that should be implemented to provide the implementation for a accessibility check for a Revit add-in External Command.

Namespace: Autodesk.Revit.UI
Assembly: RevitAPIUI (in RevitAPIUI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public interface IExternalCommandAvailability

The IExternalCommandAvailability type exposes the following members.

Methods
Name Description
Public method IsCommandAvailable Implement this method to provide control over whether your external command is enabled or disabled.
Top
Remarks
This interface should share the same assembly with add-in External Command.
Example
public class SampleAccessibilityCheck : IExternalCommandAvailability
{
    public bool IsCommandAvailable(Autodesk.Revit.UI.UIApplication applicationData, 
        CategorySet selectedCategories)
    {
        // Allow button click if there is no active selection
        if (selectedCategories.IsEmpty)
            return true;
        // Allow button click if there is at least one wall selected
        foreach (Category c in selectedCategories)
        {
            if (c.BuiltInCategory == BuiltInCategory.OST_Walls)
                return true;
        }
        return false;
    }
}
See Also
ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →