Make a Pie-Specials Menu, dependent on selection type I want to do the following with Python:

I have 3 different menus, and I want them to appear, dependent on the selection mode.

So when I'm in faceselectmode, I want with the same button a different menu as if I'm in vertselectmode.

I think, with a for loop that could be possible, but I don't now how to set variables that makes sense and also the rest of that code could be complex.

So I just need a for loop which checks in which select mode I am in. Because it's possible that there could be more options chosen, I thought that the best solution would be to get only a special menu, when there is only one selection type.

So that's the code I have so far (doesn't work) the bool variables also could be one step too much.

import bpy
from bpy.types import Menu

select_vert=bool

select_edge=bool

select_face=bool

tool_settings.mesh_select_mode=tsm

for bpy.ops.mesh.select_mode in type #what?

    if  type ='VERT'
    select_vert=True
    select_edge=False
    select_face=False

    elif type ='EDGE'
    select_vert=False
    select_edge=True
    select_face=False

    elif type = 'FACE'
    select_vert=False
    select_edge=False
    select_face=True
In blenders text editor you can find a template for creating a pie menu. You will probably want to turn your script into an addon to make your menu available every time you start blender.

Starting with the pie template, you want to alter the menus draw() to work how you want.

In the context that you get in the draw method, you can access tool_settings.mesh_select_mode which is the three boolean values for the current select mode setting. You then test them to decide if you add the related items.

def draw(self, context):
    layout = self.layout
    pie = layout.menu_pie()
    sel_mode = context.tool_settings.mesh_select_mode
    if sel_mode[0]: # vertex on
        pie.operator('mesh.remove_doubles')
        pie.operator('mesh.merge')
        if not sel_mode[1]:
            # only vert select - don't show if edge sel is also active
            pie.operator('mesh.bevel', text='Vertex Bevel').vertex_only=True
    if sel_mode[1]: # edge on
        pie.operator('mesh.mark_seam')
        pie.operator('mesh.edge_rotate').use_ccw=False
        pie.operator('mesh.bevel', text='Edge Bevel').vertex_only=False
    if sel_mode[2]: # face on
        pie.operator('mesh.flip_normals')
        pie.operator('mesh.inset')
        pie.operator('mesh.poke')