Post #246: ![](https://blenderartists.org/user_avatar/blenderartists.org/leafar/48/661663_2

📋 Metadata

  • Author: roaoao
  • Date: 2016-07-30 07:55:20
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_00245

🏷️ Tags

macro python-scripting intermediate solved

  • Macro Editor
  • Python Scripting
  • Command tab
  • External scripts

💬 Content

Leafar:

I am trying to use just certain parts of Wazou´s PMs via scripts but I don´t get it… I use, this one for example for putting the center of an object in a selected part of one mesh, anyone can help me?

In this case you just need to copy the code from execute function (without return line).

saved_location = bpy.context.scene.cursor_location.copy()
bpy.ops.view3d.snap_cursor_to_selected()
bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
bpy.context.scene.cursor_location = saved_location

Save this script as *.py file and you will be able to use it as an external script in Command tab.


🔗 View on Blender Artists