Eplan Platform API
EPLAN API / User Guide / API Framework / Add-ins / Adding ribbon commands
In This Topic
Adding ribbon commands
In This Topic

An add-in can add one or more ribbon commands to the Extensions->API command gropup. Therefore the class Eplan.EplApi.Gui.RibbonBar provides a function AddCommand which should be called in the OnRegister() method of the add-in  class: 

 

/// <summary>
/// The function is called once during registration add-in.
/// </summary>
/// <param name="bLoadOnStart"> true: In the next Eplan session, add-in will be loaded during initialization</param>
/// <returns></returns>
public bool OnRegister(ref System.Boolean bLoadOnStart)
{
   var ribbonBar= new Eplan.EplApi.Gui.RibbonBar();
   ribbonBar.AddCommand("CSharpAction", "CSharpAction");
   return true;
}

/// <summary>
/// The function is called during unregistration the add-in.
/// </summary>
/// <returns></returns>
public bool OnUnregister()
{
    var ribbonBar = new Eplan.EplApi.Gui.RibbonBar();
    return ribbonBar.RemoveCommand("CSharpAction");
}

 

The function AddCommand(text, command line) adds a button (i.e ribbon command) with the text "CSharpAction" and assigns the action "CSharpAction" to it. The button is then visible in Extensions->API command group. It is also possible to add

it to a custom command group that exists in either persistent or a custom tab.

Ribbon commands are always assigned to an action. This can be either custom action (created by API) or already existing  existing action.

See Also

Scripts

API Miscellaneous