import MaxPlus def doSomething(): print "I sleep all night and I work all day!" action = MaxPlus.ActionFactory.Create('Do something', 'Python demo', doSomething) action.Execute()
See demoActionFactory.py for an example of creating an action.
The process of creating a menu can be outlined as follows:
action = MaxPlus.ActionFactory.Create('Do something', 'Python demos', doSomething)
mb = MaxPlus.MenuBuilder(MenuName)
mb.AddItem(action) mb.AddSeparator()
menu = mb.Create(MaxPlus.MenuManager.GetMainMenu())
A Menu is created.
See demoMenu.py for an example of how to create a new menu 'Test' and unregister and remove it.
This example first removes any previously created menus named 'Test', then prints out a list of all menu items in 3dsMax. It then creates an action and a new menu, and prints out again a list of all menu items. You can see from the list that a new 'Test' menu has been created.
The example then unregisters the newly created menu and removes it, and prints out a list of all menu items again. You can see from the list that the menu has been successfully removed.