I have written an add-in that does several tasks. When we were using 2019 I was able to create additional context menu items for the OFFSET command to set the distance of the offset to a set of preset values. Now when I recompile for 2021 those context menu items never show up. As an example:
In DsAddin.ConnectToDraftSight() I have this code which uses a previously defined command (the command is registered and available on the Command Window):
dsCreateCommandError_e error;
UserCommand user_cmd = dsApp.CreateUserCommand(
AddinGUID,
"DISTANCE003125",
"0.03125\\n",
"Set Offset Distance to 1/32",
string.Empty,
string.Empty,
dsUIState_e.dsUIState_Document,
out error
);
UserCommand user_cmd2 = dsApp.CreateUserCommand(
AddinGUID,
"DISTANCE003125",
"0.03125\\n",
"Set Offset Distance to 1/32",
string.Empty,
string.Empty,
dsUIState_e.dsUIState_Document,
out error
);
ContextMenuItem menu_item = dsApp.AddCommandContextMenu(
Guid.NewGuid().ToString(),
dsMenuItemType_e.dsMenuItemType_Menu,
"Presets",
"",
"_OFFSET"
);
ContextMenuItem sub_menu_item = menu_item.InsertMenuItem(
AddinGUID,
dsMenuItemType_e.dsMenuItemType_UserCommand,
1,
"Distance 1/32",
user_cmd.GetID()
);
ContextMenuItem sub_menu_item = menu_item.InsertMenuItem(
AddinGUID,
dsMenuItemType_e.dsMenuItemType_UserCommand,
2,
"Distance 1/8",
user_cmd2.GetID()
);
But it is never displayed in the command's context menu. I am able to get one menu item when added with a command as a dsMenuItemType_e.dsMenuItemType_UserCommand (always just the last one if I add multiple) but the menu with submenu never shows up (eg. it should look like the "Esnap Overrides" menu item with submenu).
