Post #5189: Good attempt. You’ll need to use Bmesh for this.

📋 Metadata

🏷️ Tags

v1-18-7 macro scripting advanced solved

  • Macro Editor
  • Python Scripting
  • Autorun Scripts

💬 Content

Good attempt. You’ll need to use Bmesh for this.
I created a function in the past to get the number of selected mesh elements, but I’ve made some small modifications, so I’m sharing it again.
pme_autorun_get_mesh_selection.py (2.6 KB)

Please place this file in pie_menu_editor\scripts\autorun and restart Blender.
You’ll be able to use get_mesh_selection(context) or its alias gms(context) within PME.
This function returns a tuple of the number of currently selected vertices, edges, and faces. Your idea can be realized like this:

s = gms(C); return C.active_object and C.mode == 'EDIT_MESH' and C.tool_settings.mesh_select_mode[2] and s and s[2] > 0

imageimage1726×1119 180 KB

Pie Menu Editor 1.18.7 Released Scripts and Themes

Hello. If you want to get the number of selected elements in Mesh Edit Mode, use bmesh. However, I thought it would be tedious to write that process every time, so I created a function called get_mesh_selection. Put this file in “pie_menu_editor\scripts\autorun”. Then restart Blender. (Restart your PC if necessary) You can use it as gms() in the Pie Menu Editor. This function returns a tuple of the number of currently selected vertices, edges, and faces. Your idea can be realized this way. s…


❤️ 4 likes


🔗 View on Blender Artists