Skip to content

2025.0.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 02 Apr 11:31
  • Revit 2025 support
  • New FindParameter() overloads with GUID and Definition. This method combines all API methods for getting a parameter, such as get_Parameter, LookupParameter, GetParameter. It also searches for a parameter in the element type if there is no such parameter in the element
  • GetParameter() method is obsolete. Use FindParameter() instead
  • New extensions to help you add context menu items without creating additional classes or specifying type names. Revit 2025 and higher

The ConfigureContextMenu() method registers an action used to configure a Context menu.

application.ConfigureContextMenu(menu =>
{
    menu.AddMenuItem<Command>("Menu title");
    menu.AddMenuItem<Command>("Menu title")
        .SetAvailabilityController<Controller>()
        .SetToolTip("Description");
});

You can also specify your own context menu title. By default, Revit uses the Application name

application.ConfigureContextMenu("Title", menu =>
{
    menu.AddMenuItem<Command>("Menu title");
});

The AddMenuItem() method adds a menu item to the Context Menu.

menu.AddMenuItem<Command>("Menu title");

The AddSeparator() method adds a separator to the Context Menu.

menu.AddSeparator();

The AddSubMenu() method adds a sub menu to the Context Menu.

var subMenu = new ContextMenu();
subMenu.AddMenuItem<Command>("Menu title");
subMenu.AddMenuItem<Command>("Menu title");

menu.AddSubMenu("Sub menu title", subMenu);

The SetAvailabilityController() method specifies the class type that decides the availability of menu item.

menuItem.SetAvailabilityController<Controller>()

Full changelog: 2024.0.0...2025.0.0