MAXScript Tools and Interaction with 3ds Max > Interacting with the 3ds Max User Interface > Menu Manager >

# Menu and CUI Loading

You can load a menu file in MAXScript as follows:

    menuMan.loadMenuFile "MaxModelingMenu.mnu"

The full path should not be specified. It will look in the appropriate directories for menu files. The default is the "ui" directory.

You can set the main menu in max as follows:

    menuMan.setMainMenuBar "Menu Bar1"

To restore MAX's default main menu:

    menuMan.setMainMenuBar "Main Menu Bar"

The function returns true of it succeeds and false if it can't find the named menu.

You can set the quad right-click menu that MAX uses in the viewports using the following MAXScript:

    menuMan.setViewportRightClickMenu #nonePressed "Modeling 2"

Sets the default (no keys pressed) quad menu to "Modeling 2". The menu name must be a quad menu that is listed in the "Quads" customization dialog, and the name must match exactly, including capitalization.

For the first parameter, you can use one of the following 8 values:

    #nonePressed #shiftPressed #altPressed #controlPressed #shiftAndAltPressed #shiftAndControlPressed #controlAndAltPressed #shiftAndAltAndControlPressed

Here are two macroScripts that set and reset two of the right-click menus:

EXAMPLE
    macroScript SetQuads
    category:"Custom UI"
    tooltip:"Set Quad"
    (
    on execute do
    (
    menuMan.setViewportRightClickMenu #nonePressed "Modeling 2"
    menuMan.setViewportRightClickMenu #controlPressed "Sample 4x1"
    )
    )
    ------------------------------
    macroScript ResetQuads
    category:"Custom UI"
    tooltip:"Reset Quads"
    (
    on execute do
    (
    menuMan.setViewportRightClickMenu #nonePressed "Default Viewport Quad"
    menuMan.setViewportRightClickMenu #controlPressed "Modeling 1 [Cntrl+RMB]"
    )
    )

You can display a quad menu like this:

    menuMan.trackQuadMenu "Default Viewport Quad"

The menu name must be a quad menu that is listed in the "Quads" customization dialog, and the name must match exactly, including capitalization.

You can load a CUI file from MAXScript as follows:

    maxOps.loadCUIFile "ModelingCUI.cui"

It will search the appropriate UI directory for the .cui file.

#### See Also

- Interface: maxOps

- Menu Manager

- Interface: menuMan

- 3ds MaxSystem Globals