Addon to create custom menu

Hi,

I wonder if it is possible to create an addon for making custom menu easilly.

For exemple, we have a listing of commands > https://www.dropbox.com/s/5sd7nzu3t44ufki/commandes_blender.py

We normaly could make an addon with the listing who will make a custom menu easilly.

For a custom menu we just need that king of code

import bpy



class customMenu(bpy.types.Menu):
    bl_label = "Custom Menu"
    bl_idname = "View3D.customMenu"
 
    
    def draw(self, context):
        layout = self.layout
        
        layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')
        
        
     
def register():
    bpy.utils.register_class(customMenu)
    bpy.ops.wm.call_menu(name=customMenu.bl_idname)




def unregister():
    bpy.utils.unregister_class(customMenu)  




if __name__ == "__main__":     register()

To add a submenu, we just need this kind of code.

class subMenu1(bpy.types.Menu):
   
    bl_label = "Add Mesh"


    
    def draw(self, context):
        layout = self.layout

        layout.operator("mesh.primitive_cube_add", text="Cube", icon='MESH_CUBE')

bpy.utils.register_class(subMenu1)

and add layout.menu(“subMenu1”, icon=‘OBJECT_DATAMODE’) to draw the menu in the custom menu.

So it’s not so complicated, so is it possible to automatise that ?

Not sure exactly what the final question is, but if I wanted to create a addon to create menus, I would create a menu that would generate the code with the necessary input and then run the code. BTW use the "

" tags when posting code, it helps when reading.

Yes, an addon in the T menu for exemple, with some buttons, create new tex, create submenu, with te listing of commands and icons etc.