public interface IExternalCommandAvailability
The IExternalCommandAvailability type exposes the following members.
| Name | Description | |
|---|---|---|
| IsCommandAvailable | Implement this method to provide control over whether your external command is enabled or disabled. |
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; } }
Public Class SampleAccessibilityCheck Implements IExternalCommandAvailability Public Function IsCommandAvailable(applicationData As Autodesk.Revit.UI.UIApplication, selectedCategories As CategorySet) As Boolean Implements IExternalCommandAvailability.IsCommandAvailable ' Allow button click if there is no active selection If selectedCategories.IsEmpty Then Return True End If ' Allow button click if there is at least one wall selected For Each c As Category In selectedCategories If c.BuiltInCategory = BuiltInCategory.OST_Walls Then Return True End If Next Return False End Function End Class