Adds a menu item at the end of the menu and attaches a command.
The command is fired when the menu item is selected. You can attach
any native or custom commands you want to a menu item. If your menu
is attached to a contextual menu and one of your command's
arguments takes the selected object(s) by default, then the
currently selected objects is passed to your command. The target
object under the cursor is also passed in as part of the selected
objects. However if no objects are selected, then only the target
is passed in. See ArgumentCollection.AddWithHandler
for defining a custom command's argument that takes the selected
objects by default.
Tip: See any of the examples for creating a Simple Menu
plug-in to see this method in action.
Note: This method could return an invalid object in python, use
Menu.AddCommandItem2
instead.
MenuItem Menu.AddCommandItem( String in_pLabel, Object in_cmd ); |
oReturn = Menu.AddCommandItem( Label, Command ); |
The newly created MenuItem object.
Parameter | Type | Description |
---|---|---|
Label | String | The menu item label. |
Command | String or Command | The name of a command or a command object that will be invoked when the menu item is selected. This is the real name (SIObject.Name) of the command, not the Command.ScriptingName. You can find the Name of a command by running it and then checking the Edit menu (where the Name of the last executed command always appears after 'Repeat' and 'Undo'). Commands are also listed by name in the customize toolbar dialog and the scene explorer. |
MenuItem Command Command.Enabled Command.ScriptingName MenuItem.Command ArgumentCollection.AddWithHandler siMenuAnchorPoints Definition Callbacks for Menus Simple Menu plug-in example