Customize ribbon bar

Solution Partner Creator Solution Partner Creator
Solution Partner Creator

Hi

 

I have to do an installer for my application working on Solid Edge (ST6)

The application is not AddIn, and i would like it to regular exe application

Manually i can add the Macro button in any environment, but i can't do so by API.

 

The goal is to add two buttons to the existing user's theme, to Home tab (not to AddIns)

 

I have found RibbonCustom.xml contains the definition of user ribbon theme, but it`s complicated to find a correct place to insert my values inside for adding new group with 2 buttons on Home tab.

 

The second way is to do so by API.

Here is my code (C#):

 

SE_Application.Customization.BeginCustomization();
SolidEdgeFramework.RibbonBars Ribbon_Bars = SE_Application.Customization.RibbonBarThemes.Item("Customer Theme").RibbonBars;
SolidEdgeFramework.RibbonBar Assembly_Ribbon = null;
for (int a = 0; a < Ribbon_Bars.Count;a++ )
{
if (Ribbon_Bars.Item(a).Environment == "Assembly")
{
Assembly_Ribbon = Ribbon_Bars.Item(a);
break;
}
}
SolidEdgeFramework.RibbonBarTab Home_Tab = Assembly_Ribbon.RibbonBarTabs.Item("Home");
SolidEdgeFramework.RibbonBarGroup Ribbon_Group = Home_Tab.RibbonBarGroups.Insert("My Group", null, SolidEdgeFramework.RibbonBarInsertMode.seRibbonBarInsertCreate);
Ribbon_Group.Name = "My Group";
Ribbon_Group.Visible = true;

SolidEdgeFramework.RibbonBarControl Split_Button;

Split_Button = Ribbon_Group.RibbonBarControls.Insert("900000", null, SolidEdgeFramework.RibbonBarInsertMode.seRibbonBarInsertCreateSplitButtonPopup);
Split_Button.Size = SolidEdgeFramework.RibbonBarControlSize.seRibbonBarControlSizeLarge;
Split_Button.Visible = true;
Split_Button.Name = "My Macro Button";
Split_Button.Text = SolidEdgeFramework.RibbonBarControlText.seRibbonBarControlTextDefault;
SE_Application.Customization.RibbonBarThemes.ActivateTheme(Ribbon_Bars);
SE_Application.Customization.EndCustomization();

 

This code runs with no exceptions, but does nothing.

In the help documentation there is nothing written about the way to use the functions.

 

There is some example to do it right way?

 

Thanks,

Yevgeny Leibman

1 REPLY

Re: Customize ribbon bar

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Yevgeny,

 

I just created and committed a new sample in the Solid Edge Community Samples on GitHub. You can download the latest set of samples or just look at RibbonCustomization/MainForm.cs. The code should cover everything you were struggling with (hopefully).

 

 

Jason Newell
Applications Architect
www.jasonnewell.net