ricaun.Revit.UI 0.7.0

Prefix Reserved
dotnet add package ricaun.Revit.UI --version 0.7.0                
NuGet\Install-Package ricaun.Revit.UI -Version 0.7.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ricaun.Revit.UI" Version="0.7.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ricaun.Revit.UI --version 0.7.0                
#r "nuget: ricaun.Revit.UI, 0.7.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ricaun.Revit.UI as a Cake Addin
#addin nuget:?package=ricaun.Revit.UI&version=0.7.0

// Install ricaun.Revit.UI as a Cake Tool
#tool nuget:?package=ricaun.Revit.UI&version=0.7.0                

ricaun.Revit.UI

Revit 2017 Visual Studio 2022 Nuke License MIT Build Release

ricaun Revit UI

ricaun.Revit.UI package makes it easier to work with UI and RevitApi, especially with RibbonPanel, RibbonTab, RibbonButton, and RibbonItem in general.

This project was generated by the ricaun.AppLoader Revit plugin, the test project uses the ricaun.RevitTest test framework.

Features

ricaun.Revit.UI package is designed to work with the plugin AppLoader that allows loading Revit Applications on runtime.

[AppLoader]
public class App : IExternalApplication
{
    private RibbonPanel ribbonPanel;
    public Result OnStartup(UIControlledApplication application)
    {
        ribbonPanel = application.CreatePanel("PanelName");

        var commandButton = ribbonPanel.CreatePushButton<Commands.Command>()
            .SetText("Command")
            .SetToolTip("This is a tooltip.")
            .SetLongDescription("This is a description.")
            .SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");

        if (LanguageExtension.IsBrazilianPortuguese)
        {
            commandButton.SetText("Comando")
                .SetToolTip("Esta é uma dica de ferramenta.")
                .SetLongDescription("Esta é uma descrição.");
        }

        return Result.Succeeded;
    }

    public Result OnShutdown(UIControlledApplication application)
    {
        ribbonPanel?.Remove();
        return Result.Succeeded;
    }
}

RibbonPanel Extension

RibbonPanelExtension contains methods related to Autodesk.Windows.RibbonPanel and Autodesk.Revit.UI.RibbonPanel

UIControlledApplication application;
RibbonPanel ribbonPanel = application.CreatePanel("PanelName");
// application.CreatePanel("TabName", "PanelName");
// application.CreateOrSelectPanel("PanelName");
// application.CreateOrSelectPanel("TabName", "PanelName");

The method GetRibbonItems allow to select all RibbonItem concatenated on the RibbonPanel.

IList<RibbonItem> ribbonItems = ribbonPanel.GetRibbonItems();

The method GetRibbonPanel allow to select Autodesk.Windows.RibbonPanel.

Autodesk.Windows.RibbonPanel awRibbonPanel = ribbonPanel.GetRibbonPanel();

The method Remove allow to remove the RibbonPanel from Autodesk.Windows UI.

ribbonPanel.Remove();

RibbonButton Extension

RibbonButtonExtension contains methods related to PushButton and PushButtonData

PushButton pushButton = ribbonPanel.CreatePushButton<IExternalCommand>();
// ribbonPanel.CreatePushButton<IExternalCommand>("ButtonName");
// ribbonPanel.CreatePushButton<IExternalCommand,IExternalCommandAvailability>();
// ribbonPanel.CreatePushButton<IExternalCommand,IExternalCommandAvailability>("ButtonName");
PushButtonData pushButtonData = ribbonPanel.NewPushButtonData<IExternalCommand>();
// ribbonPanel.NewPushButtonData<IExternalCommand>("ButtonDataName");
// ribbonPanel.NewPushButtonData<IExternalCommand,IExternalCommandAvailability>();
// ribbonPanel.NewPushButtonData<IExternalCommand,IExternalCommandAvailability>("ButtonDataName");
// pushButton.SetAvailability<IExternalCommandAvailability>();
// pushButtonData.SetAvailability<IExternalCommandAvailability>();

RibbonItem Extension

RibbonItemExtension contains methods related to RibbonItem

var ribbonItem = ribbonPanel.CreatePushButton<Commands.Command>();
ribbonItem.SetText("RibbonItemName");
ribbonItem.SetToolTip("ToolTip");
ribbonItem.SetLongDescription("LongDescription");
ribbonItem.SetContextualHelp("ContextualHelpUrl");
ribbonItem.SetItemSize();
ribbonItem.SetShowText();
ribbonItem.SetShowImage();
ribbonItem.SetImage(ImageSource);
ribbonItem.SetLargeImage(ImageSource);
ribbonItem.SetToolTipImage(ImageSource);

or

var ribbonItem = ribbonPanel
    .CreatePushButton<Commands.Command>()
    .SetText("RibbonItemName")
    .SetToolTip("ToolTip")
    .SetLongDescription("LongDescription")
    .SetContextualHelp("ContextualHelpUrl")
    .SetItemSize()
    .SetShowText()
    .SetShowImage()
    .SetImage(ImageSource)
    .SetLargeImage(ImageSource)
    .SetToolTipImage(ImageSource);

RibbonItemData Extension

RibbonItemDataExtension contains methods related to RibbonItemData

var ribbonItemData = ribbonPanel.NewPushButtonData<Commands.Command>();
ribbonItemData.SetText("RibbonItemName");
ribbonItemData.SetToolTip("ToolTip");
ribbonItemData.SetLongDescription("LongDescription");
ribbonItemData.SetContextualHelp("ContextualHelpUrl");
ribbonItemData.SetImage(ImageSource);
ribbonItemData.SetLargeImage(ImageSource);
ribbonItemData.SetToolTipImage(ImageSource);

or

var ribbonItemData = ribbonPanel
    .NewPushButtonData<Commands.Command>()
    .SetText("RibbonItemName")
    .SetToolTip("ToolTip")
    .SetLongDescription("LongDescription")
    .SetContextualHelp("ContextualHelpUrl")
    .SetImage(ImageSource)
    .SetLargeImage(ImageSource)
    .SetToolTipImage(ImageSource);

RibbonComboBox Extension

RibbonComboBoxExtension contains methods related to ComboBox, ComboBoxData, and ComboBoxMemberData.

ComboBox comboBox = ribbonPanel.CreateComboBox();
// ribbonPanel.CreateComboBox("ComboBoxName");
// ribbonPanel.CreateComboBox("ComboBoxName", ComboBoxMemberData, ComboBoxMemberData, ...);
comboBox.AddComboBoxMembers(ComboBoxMemberData, ComboBoxMemberData, ...);
comboBox.SetWidth(120);
comboBox.SetCurrent(comboBox.Current);
comboBox.AddCurrentChanged(OnCurrentChanged);
comboBox.RemoveCurrentChanged(OnCurrentChanged);
comboBox.AddDropDownOpened(OnDropDownOpened);
comboBox.RemoveDropDownOpened(OnDropDownOpened);
comboBox.AddDropDownClosed(OnDropDownClosed);
comboBox.RemoveDropDownClosed(OnDropDownClosed);
ComboBoxMember comboBoxMember = comboBox.CreateComboBoxMember();
// comboBox.CreateComboBoxMember("Name");
// comboBox.CreateComboBoxMember("Name", "GroupName");
ComboBoxData comboBoxData = ribbonPanel.NewComboBoxData();
// ribbonPanel.NewComboBoxData("ComboBoxDataName");
ComboBoxMemberData comboBoxMemberData = ribbonPanel.NewComboBoxMemberData();
// ribbonPanel.NewComboBoxMemberData("ComboBoxMemberDataName");
comboBoxMemberData.SetGroupName("GroupName");

RibbonPulldown Extension

PulldownButtonExtension contains methods related to PulldownButton

PulldownButton pulldownButton = ribbonPanel.CreatePulldownButton();
// ribbonPanel.CreatePulldownButton(PushButtonData, PushButtonData, ...);
// ribbonPanel.CreatePulldownButton("PulldownButtonName");
// ribbonPanel.CreatePulldownButton("PulldownButtonName", PushButtonData, PushButtonData, ...);
pulldownButton.SetListImageSize();
PushButton pushButton = pulldownButton.CreatePushButton<IExternalCommand>();
// pulldownButton.CreatePushButton<IExternalCommand>("ButtonName");
// pulldownButton.CreatePushButton<IExternalCommand,IExternalCommandAvailability>();
// pulldownButton.CreatePushButton<IExternalCommand,IExternalCommandAvailability>("ButtonName");
PushButtonData pushButtonData = pulldownButton.NewPushButtonData<IExternalCommand>();
// pulldownButton.NewPushButtonData<IExternalCommand>("ButtonDataName");
// pulldownButton.NewPushButtonData<IExternalCommand,IExternalCommandAvailability>();
// pulldownButton.NewPushButtonData<IExternalCommand,IExternalCommandAvailability>("ButtonDataName");
pulldownButton.AddPushButtons(PushButtonData, PushButtonData, ...);

RibbonRadio Extension

RibbonRadioExtension contains methods related to RadioButtonGroup, RadioButtonGroupData, and ToggleButtonData

RadioButtonGroup radioButtonGroup = ribbonPanel.CreateRadioButtonGroup();
// ribbonPanel.CreateRadioButtonGroup("RadioButtonGroupName");
// ribbonPanel.CreateRadioButtonGroup("RadioButtonGroupName", ToggleButtonData, ToggleButtonData, ...);
radioButtonGroup.AddToggleButtons(ToggleButtonData, ToggleButtonData, ...);
RadioButtonGroupData radioButtonGroupData = ribbonPanel.NewRadioButtonGroupData("RadioButtonGroupDataName");
ToggleButtonData ToggleButtonData = ribbonPanel.NewToggleButtonData();
// ribbonPanel.NewToggleButtonData("ToggleButtonDataName");
// ribbonPanel.NewToggleButtonData<IExternalCommand>();
// ribbonPanel.NewToggleButtonData<IExternalCommand>("ToggleButtonDataName");
// ribbonPanel.NewToggleButtonData<IExternalCommand, IExternalCommandAvailability>();
// ribbonPanel.NewToggleButtonData<IExternalCommand, IExternalCommandAvailability>("ToggleButtonDataName");

RibbonSplit Extension

SplitButtonExtension contains methods related to SplitButton

SplitButton splitButton = ribbonPanel.CreateSplitButton();
// ribbonPanel.CreateSplitButton(PushButtonData, PushButtonData, ...);
// ribbonPanel.CreateSplitButton("SplitButtonName");
// ribbonPanel.CreateSplitButton("SplitButtonName", PushButtonData, PushButtonData, ...);
PushButton pushButton = splitButton.CreatePushButton<IExternalCommand>();
// splitButton.CreatePushButton<IExternalCommand>("ButtonName");
// splitButton.CreatePushButton<IExternalCommand,IExternalCommandAvailability>();
// splitButton.CreatePushButton<IExternalCommand,IExternalCommandAvailability>("ButtonName");
PushButtonData pushButtonData = splitButton.NewPushButtonData<IExternalCommand>();
// splitButton.NewPushButtonData<IExternalCommand>("ButtonDataName");
// splitButton.NewPushButtonData<IExternalCommand,IExternalCommandAvailability>();
// splitButton.NewPushButtonData<IExternalCommand,IExternalCommandAvailability>("ButtonDataName");
splitButton.AddPushButtons(PushButtonData, PushButtonData, ...);

RibbonTextBox Extension

RibbonTextBoxExtension contains methods related to TextBox and TextBoxData

TextBox textBox = ribbonPanel.CreateTextBox();
// ribbonPanel.CreateTextBox("TextBoxName");
textBox.SetValue("Value");
textBox.SetPromptText("PromptText");
textBox.SetShowImageAsButton(true);
textBox.SetSelectTextOnFocus(true);
textBox.SetWidth(120);
textBox.AddEnterPressed(OnEnterPressed);
textBox.RemoveEnterPressed(OnEnterPressed);
TextBoxData textBoxData = ribbonPanel.NewTextBoxData();
// ribbonPanel.NewTextBoxData("TextBoxNameData");

RibbonUtil Extension

Autodesk.Revit.UI.RibbonItem --> Autodesk.Windows.RibbonItem

Autodesk.Revit.UI.RibbonItem ribbonItem;
Autodesk.Windows.RibbonItem awRibbonItem = ribbonItem.GetRibbonItem();

Autodesk.Revit.UI.RibbonPanel --> Autodesk.Windows.RibbonPanel

Autodesk.Revit.UI.RibbonPanel ribbonPanel;
Autodesk.Windows.RibbonPanel awRibbonPanel = ribbonPanel.GetRibbonPanel();

RibbonTab Extension

RibbonTabExtension contains methods related to Autodesk.Windows.RibbonTab

Autodesk.Windows.RibbonTab awRibbonTab = ribbonPanel.GetRibbonTab();
Autodesk.Windows.RibbonTab awRibbonTab = RibbonTabExtension.GetRibbonTab("TabId");
IList<Autodesk.Windows.RibbonTab> awRibbonTabs = RibbonTabExtension.GetRibbonTabs();

The method SetPanelsOrderBy and SetPanelsOrderByTitle allow reorder the RibbonPanel in the RibbonTab UI.

Autodesk.Windows.RibbonTab awRibbonTab = ribbonPanel.GetRibbonTab();
awRibbonTab.SetPanelsOrderBy(e => e.Source.Title);
awRibbonTab.SetPanelsOrderByTitle();

The method Remove allow to remove the RibbonTab from Autodesk.Windows UI.

awRibbonTab.Remove();

QuickAccessToolBar Extension

QuickAccessToolBarExtension contains methods related to add and remove Autodesk.Windows.RibbonItem to the QuickAccessToolBar.

ribbonItem.AddQuickAccessToolBar();
ribbonItem.RemoveQuickAccessToolBar();

Autodesk Extension

The SetAutodeskOwner() method applies the window as an Autodesk owner.

Window window = new MainWindow();
window.SetAutodeskOwner();

Bitmap Extension

The GetBitmapSource() method transform base64orUriString or imageAsResourceString in BitmapSource.

string base64orUri;
BitmapSource bitmapSource = base64orUri.GetBitmapSource();
string imageAsResourceString;
BitmapSource bitmapSource = imageAsResourceString.GetBitmapSource();

Drawing Bitmap Extension

The GetBitmapSource() method transform Bitmap, Icon, Image in BitmapSource. The extension is located in the namespace ricaun.Revit.UI.Drawing.

System.Drawing.Bitmap bitmap;
BitmapSource bitmapSource = bitmap.GetBitmapSource();
System.Drawing.Icon icon;
BitmapSource bitmapSource = icon.GetBitmapSource();
System.Drawing.Image image;
BitmapSource bitmapSource = image.GetBitmapSource();

Language Extension

LanguageExtension contains methods related to the application language.

LanguageType languageType = LanguageExtension.GetLanguageType();
// LanguageExtension.IsEnglish;
// LanguageExtension.IsFrench;
// LanguageExtension.IsGerman;
// LanguageExtension.IsItalian;
// LanguageExtension.IsJapanese;
// LanguageExtension.IsKorean;
// LanguageExtension.IsPolish;
// LanguageExtension.IsSpanish;
// LanguageExtension.IsChineseSimplified;
// LanguageExtension.IsChineseTraditional;
// LanguageExtension.IsBrazilianPortuguese;
// LanguageExtension.IsRussian;
// LanguageExtension.IsCzech;

Ribbon Stacked Extension

Create Autodesk.Windows.RibbonFlowPanel and Autodesk.Windows.RibbonRowPanel using Autodesk.Revit.UI.RibbonItem array.

Autodesk.Revit.UI.RibbonItem[] ribbonItems;
Autodesk.Windows.RibbonFlowPanel awRibbonFlowPanel = ribbonPanel.FlowStackedItems(ribbonItems);
Autodesk.Revit.UI.RibbonItem[] ribbonItems;
Autodesk.Windows.RibbonRowPanel[] awRibbonRowPanels = ribbonPanel.RowStackedItems(ribbonItems);
Autodesk.Revit.UI.RibbonItem[] ribbonItems;
Autodesk.Windows.RibbonRowPanel[] awRibbonRowPanels = ribbonPanel.RowLargeStackedItems(ribbonItems);

Ribbon DialogLauncher Extension

Create DialogLauncher in a Autodesk.Revit.UI.RibbonPanel using Autodesk.Revit.UI.PushButton.

Autodesk.Revit.UI.PushButton pushButton;
ribbonPanel.SetDialogLauncher(pushButton);
Autodesk.Windows.RibbonPanel awRibbonPanel;
Autodesk.Windows.RibbonCommandItem ribbonCommandItem = awRibbonPanel.GetDialogLauncher();
Autodesk.Windows.RibbonCommandItem ribbonCommandItem;
Autodesk.Windows.RibbonPanel awRibbonPanel;
awRibbonPanel.SetDialogLauncher(ribbonCommandItem);

Ribbon Description Extension

... Todo

Release

License

This Project is licensed under the MIT License.


Do you like this package? Please star this project on GitHub!

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 is compatible.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6

    • No dependencies.
  • .NETFramework 4.7

    • No dependencies.
  • .NETFramework 4.8

    • No dependencies.
  • net8.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.7.0 908 7/28/2024
0.6.2 1,462 2/5/2024
0.6.1 429 12/18/2023
0.6.0 206 12/5/2023
0.5.7 258 11/18/2023
0.5.6 167 11/9/2023
0.5.5 139 11/4/2023
0.5.4 193 10/20/2023
0.5.3 324 8/19/2023
0.5.2 637 4/17/2023
0.5.1 179 4/14/2023
0.5.0 179 4/13/2023
0.4.0 1,219 8/23/2022
0.3.2 385 8/16/2022
0.3.1 428 8/10/2022
0.3.0 376 8/8/2022
0.2.1 389 8/8/2022
0.2.0 534 7/10/2022
0.1.2 674 5/17/2022
0.1.1 443 5/7/2022
0.1.0 584 4/7/2022
0.0.9 451 3/23/2022
0.0.8 525 2/14/2022
0.0.7 422 2/8/2022
0.0.6 473 2/2/2022
0.0.5 450 1/25/2022
0.0.4 449 1/12/2022