How to create a custom command bar for add-in

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Hi all

 

I'll like to use the command bar for my add-in something like the picture below but with my controls, parameters button and Process button.

 

Command Bar

 

Is that possible and how ?

 

Thanks

 

Romuald


Romuald BERTIN
4 REPLIES

Re: How to create a custom command bar for add-in

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I don't have personal experience implementing this but I do know that there is an example in the Solid Edge SDK. For details on how to get the SDK on your machine, see my Solid Edge ST7 AddIn Architecture Overview article.

 

Once you have the SDK on your machine, open C:\Program Files\Solid Edge ST7\SDK\Advanced\samples\Addins\VC\AsmLoc.sln. Open locate.cpp and search for "CSampleLocateCommand::CreateRibbon". Notice that it is using a MFC dialog with resource id IDD_DIALOG1. You can view the dialog by opening AsmLoc.rc.

 

If you're not using C++ then I'm afraid you're mostly out of luck. The reason is because the Solid Edge API only allows native resources for things like images and dialogs. The relevant interface(s) and method(s) are:

 

interface ISolidEdgeRibbonBar : IUnknown {
	[helpstring(" "), helpcontext(0x0000c768)]
	HRESULT _stdcall AddRibbon(
					[in] int DialogId, 
					long InstanceHandle, 
					[out, retval] long* hWndRibbon);
};

interface ISolidEdgeRibbonBarEx : ISolidEdgeRibbonBar {
	[helpstring(" "), helpcontext(0x0098967f)]
	HRESULT _stdcall AddRibbonEx(
					[in] int DialogId, 
					BSTR ResourceFilename, 
					[out, retval] long* hWndRibbon);
};

If you notice, the DialogId parameter is an int which points to a native dialog resource id. This doesn't give us an (easy) way to create a dialog from say .NET.

 

Jason Newell
Applications Architect
www.jasonnewell.net

Re: How to create a custom command bar for add-in

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Thanks Jason.

 

I'm not familiar with C++ coding so i'll to use winforms or EdgeBar

 

For EdgeBar did we have correspondance between the imageId and the image itself ?

 

Romuald


Romuald BERTIN

Re: How to create a custom command bar for add-in

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

"For EdgeBar did we have correspondance between the imageId and the image itself ?"

I don't understand your question. Can you please elaborate.

 

Watch my Solid Edge Community Templates Quick Start video. It will show you how to quickly get a Solid Edge addin with edgebar created in .NET.

Jason Newell
Applications Architect
www.jasonnewell.net

Re: How to create a custom command bar for add-in

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Thanks Jason I found the Assemblyconfig.vb file that allow to define the icone of the edgebars


Romuald BERTIN