Working on an addin. Solidwokrs api documentation is very very bad made. Saw almost every video on youtube on the matter.
Simple thing is not working for me, cannot get why. Trying to add a menu to the bar.
public bool ConnectToSW(object ThisSW, int Cookie)
{
SwApp = (SldWorks)ThisSW;
var a = SwApp.AddMenu((int)swDocumentTypes_e.swDocPART, "MyMenu", 0);
var b = SwApp.AddMenuItem5((int)swDocumentTypes_e.swDocPART, cook, "MyMenu@Tools", 1, "MyMenuCallback", "MyMenuEnableMethod", "My menu item", null);
return true;
}
Menu is not showing. I do get the access to the other functions.
CommandGroup is working thro, but I need only a menu.
ICommandManager icmd = SwApp.GetCommandManager(cook);
ICommandGroup cmdGroup;
cmdGroup = icmd.CreateCommandGroup(1, "test", "tool test", "bla la", 0);
icmd.AddContextMenu(0, "new");
int menuToolbarOption = (int)(swCommandItemType_e.swMenuItem | swCommandItemType_e.swToolbarItem);
cmdGroup.AddCommandItem2("CreateCube", -1, "Create a cube", "Create cube", 0, "CreateCube", "", 0, menuToolbarOption);
cmdGroup.HasToolbar = true;
cmdGroup.HasMenu = true;
cmdGroup.Activate();
Please advice. Thanks
(Found in the world wide web a post that "AddMenuItem5" probably has a bug, and "AddMenuItem4" does work. is this really a bug, or I'm missing something?)