This is the basic structure of a Pie Menu in Blender using Python
import bpy
from bpy.types import Menu, Operator
bl_info = {
"name": "",
"author": "",
"version": (0, 0, 0, 1),
"description": "",
"blender": (2, 80, 0),
"category": "3D view"
}
class VIEW3D_MT_PIE_template(Menu):
# label is displayed at the center of the pie menu.
bl_label = "Operations"
bl_idname="mesh.mypie"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
pie.operator("auto.smooth")
def register():
bpy.utils.register_class(VIEW3D_MT_PIE_template)
bpy.utils.register_class(AutoSmooth)
def unregister():
bpy.utils.unregister_class(VIEW3D_MT_PIE_template)
bpy.utils.unregister_class(AutoSmooth)
if __name__ == "__main__":
register()
bpy.ops.wm.call_menu_pie(name="VIEW3D_MT_PIE_template")
class AutoSmooth(Operator):
bl_idname = "auto.smooth"
bl_label = "AutoSmooth"
def execute(self, context):
bpy.ops.object.shade_smooth()
bpy.context.object.data.use_auto_smooth = True
return {'FINISHED'}