SOLIDWORKS PDM API: Adding a right-click menu (commands) only visible from files

Which combinations of this enum (EdmMenuFlags Enumeration - 2018 - SOLIDWORKS API Help) will show new commands only in the right-click menu (Context menu) of files?

Thank you!

I’d like to say it is a combination of these (EdmMenu_OnlyFiles + EdmMenu_ContextMenuItem + EdmMenu_MustHaveSelection) but I have not tested it.

@AmenJlili your initial thoughts are correct.

Here’s the code I use for the RMB context menu of a command in one of my add-ins

(int)EdmMenuFlags.EdmMenu_OnlyInContextMenu +
(int)EdmMenuFlags.EdmMenu_MustHaveSelection +
(int)EdmMenuFlags.EdmMenu_OnlyFiles +
(int)EdmMenuFlags.EdmMenu_OnlySingleSelection

The only difference is mine does not allow multiple files to be selected

if you want coffee, I can get you some…

1 Like

The sum of those enum members is 43 if y’all in a hurry…

51 for multiple files.

If you want support for both. You need to add single selection 43 and multiselection 51 using AddCommand separately.

With PDMSDK via the menu attribute,

  [Menu((int)Commands.MultiCommand, "Command\\Multi Selection...", 51, "")]
  [Menu((int)Commands.SingleCommand, "Command\\Single Selection...", 43, "")]

Example: Definition | SOLIDWORKS PDM SDK