CUI managed API - standalone .net application - add image to RibbonCommandButton

CUI managed API - standalone .net application - add image to RibbonCommandButton

Anonymous
Not applicable
418 Views
0 Replies
Message 1 of 1

CUI managed API - standalone .net application - add image to RibbonCommandButton

Anonymous
Not applicable

Hi,

 

I'm creating standalone .net application, where I opening .cuix file, creating new ribbon panel, and adding elements.

So far so good.

Last elements I have to add are several RibbonCommandButton, which should be very simple: have image, text, and execute command. All that I can do, but cannot assign image to button.

I followed instructions from documentation, and answers on similar questions here on forum, I attempting to add image to macro, by using syntax:

 

MacroGroup macGroup = cs.MenuGroup.MacroGroups[0];

MenuMacro menuMacro = macGroup.CreateMenuMacro("SomeMacroName", "SomeCommand", "SomeTag", "SomeHelp", MacroType.Any, "[full path to image.png]", "[full path to image.png]", "SomeLabel");

However, here I get  null reference exception.

Full stack trace is:

at Autodesk.AutoCAD.Customization.CustWrap.addLooseImage(String imgSrcPathName, CustomizationSection resolver)
at Autodesk.AutoCAD.Customization.Macro..ctor(String name, String command, String helpStr, MacroType mType, String smlImage, String lgImage, String labelID, MenuMacro par)
at Autodesk.AutoCAD.Customization.MacroGroup.CreateMenuMacro(String name, String command, String tag, String help, MacroType macroType, String smallImage, String largeImage, String labelId)

I suspect that something is wrong with parameter for image. In examples I found on forum, it is only set file name for image (without path), like "image1.png".  I attempted that (put image1.png into same folder where acad.exe is, however, no success).

Then, I attempted to put here full (absolute) path to image1.png on disk, but again, the same error.

 

Can you, please, tell me what am I doing wrong?

 

Thanks.

 

 

 

0 Likes
419 Views
0 Replies
Replies (0)