Hide Table of Contents
AddMenuPopupItem3 Method (ISldWorks)

Adds a menu item with zero or more submenus to shortcut menus of entities of the specified type in documents of the specified type.

.NET Syntax

Visual Basic (Declaration) 
Function AddMenuPopupItem3( _
   ByVal DocumentType As System.Integer, _
   ByVal Cookie As System.Integer, _
   ByVal SelectType As System.Integer, _
   ByVal PopupItemName As System.String, _
   ByVal MenuCallback As System.String, _
   ByVal MenuEnableMethod As System.String, _
   ByVal HintString As System.String, _
   ByVal CustomNames As System.String _
) As System.Integer
Visual Basic (Usage) 
Dim instance As ISldWorks
Dim DocumentType As System.Integer
Dim Cookie As System.Integer
Dim SelectType As System.Integer
Dim PopupItemName As System.String
Dim MenuCallback As System.String
Dim MenuEnableMethod As System.String
Dim HintString As System.String
Dim CustomNames As System.String
Dim value As System.Integer
value = instance.AddMenuPopupItem3(DocumentType, Cookie, SelectType, PopupItemName, MenuCallback, MenuEnableMethod, HintString, CustomNames)
System.int AddMenuPopupItem3( 
   System.int DocumentType,
   System.int Cookie,
   System.int SelectType,
   System.string PopupItemName,
   System.string MenuCallback,
   System.string MenuEnableMethod,
   System.string HintString,
   System.string CustomNames
System.int AddMenuPopupItem3( 
&   System.int DocumentType,
&   System.int Cookie,
&   System.int SelectType,
&   System.String^ PopupItemName,
&   System.String^ MenuCallback,
&   System.String^ MenuEnableMethod,
&   System.String^ HintString,
&   System.String^ CustomNames



Document type as defined by swDocumentTypes_e


Cookie specified as defined in ISwAddin::ConnectToSW


Selection type as defined in swSelectType_e


Description displayed on the shortcut menu (see Remarks)


Function to be called when the user clicks your menu item (see description in ISldWorks::AddMenuItem4) (see Remarks)


Optional function that controls the state of the menu item

If specified:

  • SOLIDWORKS calls this function before displaying the menu

  • Display of the menu item is controlled by the return value of MenuEnableMethod

If your method returns...



Deselects and disables the menu item.


Deselects and enables the menu item (this is the default menu state if no update function is specified)

2 Selects and disables the menu item

Selects and enables the menu item

4 Hides the menu item

(see Remarks)

Text to show in the SOLIDWORKS status bar when the user moves their mouse over this menu item; if you specify a HintString, it must be preceded by a comma

Semi-colon separated list of the names of the custom feature types; this argument is applicable only if SelectType is a custom feature type (like swSelATTRIBUTES); in the case of swSelATTRIBUTES, set this field to the name of the attribute definition

Return Value

SOLIDWORKS runtime command ID or -1 if the method fails


Call this method for every unique set of DocumentType and SelectType in whose menus you want this menu item to display.

In PopupItemName use the at-sign (@) create submenus. To add a separator bar after a menu item, append an at-sign to PopupItemName and enclose PopupItemName in double quotes ("").


For example, specifying:

  • Edge adds menu item Edge to the shortcut menu.

  • Edge@Color adds menu item Edge and submenu Color to Edge.

  • Edge@Appearance@Color adds menu item Edge, submenu Appearance to Edge, and submenu Color to Appearance.

  • "Edge@" adds menu item Edge and a separator bar after Edge.

  • "Edge@Appearance@" adds menu item Edge, submenu Appearance to Edge, and a separator bar after Appearance.

See Add-in Callback and Enable Methods to learn how to specify MenuCallback and MenuEnableMethod.


See Also


SOLIDWORKS 2009 FCS, Revision Number 17.0

Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

Subject:   Feedback on Help Topics
Page:   AddMenuPopupItem3 Method (ISldWorks)
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:


We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again

Web Help Content Version: API Help (English only) 2019 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.