Almost all of those calls have an equivalent maya cmds function, with the difference that you pass the string name of the ui object returned from previous ui calls. So just look at the Maya cmds python api.
Getting the main window name can be done with a call into mel: gMainWindow = maya.mel.eval('$temp1=$gMainWindow') On Sun, 2 Apr 2023, 10:36 am DGFA DAG's GRAPHIC & FOTO ART, < gerome....@gmail.com> wrote: > Hi, > in Maya 2024 is no more pymel available so I have to switch to what ever... > > But I struggle with Maya cmds. > How can I translate this to cmds? > > import pymel.core as pm > # import os > # import maya.mel as mel > # main call > > def dags_menu(): > # call menu objects > main_window = pm.language.melGlobals['gMainWindow'] > menu_obj = 'DagsMenu' > menu_label = 'Dags Tools' > > if pm.menu(menu_obj, label=menu_label, parent=main_window, exists=True): > pm.deleteUI(pm.menu(menu_obj, deleteAllItems=True, e=True)) > > dags_menu = pm.menu(menu_obj, label=menu_label, parent=main_window, > tearOff=True) > > > project_menu(dags_menu) > polygon_menu(dags_menu) > object_menu(dags_menu) > script_menu(dags_menu) > material_menu(dags_menu) > rigging_menu(dags_menu) > camera_menu(dags_menu) > light_menu(dags_menu) > render_menu(dags_menu) > > > # menu Items > def project_menu(dags_menu): > # Main Submenu Project > # pm.setParent('..', menu=True) > # dags_menu = pm.menu(menu_obj, label=menu_label, parent=main_window, > tearOff=True) > pm.menuItem(label='Project', subMenu=True, parent=dags_menu, tearOff=True) > # set project > pm.menuItem( > label='Set Project', > command='SetProject', > image='fileOpen.png', > sourceType='mel', > optionBox=False, > visible=True, > ) > > pm.menuItem(divider=True) > # save > pm.menuItem( > label='Save', > command='SaveScene', > image='save.png', > sourceType='mel', > optionBox=False, > visible=True, > ) > # save as > pm.menuItem( > label='Save Scene As...', > command='SaveSceneAs', > image='save.png', > sourceType='mel', > optionBox=False, > visible=True, > ) > # save incremental > pm.menuItem( > label='Increment Save', > command='IncrementAndSave', > image='saveToShelf.png', > sourceType='mel', > optionBox=False, > visible=True, > ) > > Thanks! > D. > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to python_inside_maya+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/1b086fbd-ac54-435e-b4e7-7d90d1943eb3n%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/1b086fbd-ac54-435e-b4e7-7d90d1943eb3n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1iznu-EF3b7EwonVbutKnOoO1MTmpPRxkgNmYHggfMHw%40mail.gmail.com.