1 Reply Latest reply on Jul 12, 2016 1:46 PM by Lee CS Young

    Can I have an example PDM API showing EdmMenu_Administration?

    Edwin Chung

      Hi,

       

      Does anyone have an example that demonstrates use of EdmMenu_Administration as described on 2016 SOLIDWORKS API Help - EdmMenuFlags Enumeration ? I believe this can be used to create a "Settings" page for an Add-on which would be accessible in the Solidworks pdm Administration tool - such as the "Administrative Actions" link in Dispatch64. I believe it is used like this:

       

      Public Sub GetAddInInfo(ByRef poInfo As EdmAddInInfo, poVault As IEdmVault5, poCmdMgr As IEdmCmdMgr5) Implements IEdmAddIn5.GetAddInInfo

           '...

           poCmdMgr.AddCmd(1, "Add-in Settings", EdmMenuFlags.EdmMenu_Administration

      End Sub

       

      Is it common to make system-calls to the Registry or a local file to actually store information?

       

      Thanks in advance.

        • Re: Can I have an example PDM API showing EdmMenu_Administration?
          Lee CS Young

          Here's an example.

           

          public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 poVault, IEdmCmdMgr5 poCmdMgr)
          {
            int cmdID = 5;
            int menuFlags = (int)EdmMenuFlags.EdmMenu_Administration;
            string menuString = "Configure add-in...";
            string statusbarHelp = "Configure add-in...";
            string toolbarTooltip = "Configure add-in...";
            int toolbarButtonIndex = 0;
            int toolbarImageId = 0;
            poCmdMgr.AddCmd(cmdID, menuString, menuFlags, statusbarHelp, toolbarTooltip, toolbarButtonIndex, toolbarImageId);
          }
          
          
          public void OnCmd(ref EdmCmd poCmd, ref Array ppoData)
          {
            if (poCmd.meCmdType == EdmCmdType.EdmCmd_Menu && poCmd.mlCmdID == 5)
            {
            using (ConfigForm configForm = new ConfigForm())
            {
            configForm.ShowDialog();
            }
            }
          }
          

           

          For saving config information for your add-in, use the Dictionary.