2027 Interface
Changes 0
I

IExternalCommandAvailability

Description:
An interface that should be implemented to provide the implementation for a accessibility check for a Revit add-in External Command.
Remarks:
This interface should share the same assembly with add-in External Command.
public interface IExternalCommandAvailability
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;
    }
}
Name Return Type Description
M IsCommandAvailable(UIApplication, CategorySet) Boolean Implement this method to provide control over whether your external command is enabled or disabled.