Post #2507: ![](https://blenderartists.org/user_avatar/blenderartists.org/pinhead/48/528486_

📋 Metadata

  • Author: roaoao
  • Date: 2019-07-10 11:31:58
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_02503

🏷️ Tags

macro pie-menu python-scripting intermediate solved

  • Macro Editor
  • Pie Menu Editor
  • Python Scripting

💬 Content

Pinhead:

When i try run from top toolbar “bpy.ops.mira.curve_stretch()” (from mira tools script)
i have error message: View3D not found, cannot run operator!. Is there any chance to run those kind of scripts from custom toolbar?

Yes, try to use override_context() function in this case:

bpy.ops.mira.curve_stretch(override_context('VIEW_3D'), 'INVOKE_DEFAULT', True)

Pinhead:

Is Macro Operatoris limited to 6 commands?
When i try in pie menu run this menu the last command not working.

You are using wm.context_toggle operator which for some reason can stop macro operators in some cases.
Try to use this code:

C.space_data.overlay.show_axis_y = not C.space_data.overlay.show_axis_y

instead of:

bpy.ops.wm.context_toggle(data_path='space_data.overlay.show_axis_y')

Or add 'EXEC_DEFAULT', True arguments:

bpy.ops.wm.context_toggle('EXEC_DEFAULT', True, data_path='space_data.overlay.show_axis_y')

🔗 View on Blender Artists