Post #766: ![](https://blenderartists.org/user_avatar/blenderartists.org/yan.kansky/48/7141

๐Ÿ“‹ Metadata

  • Author: yan.kansky
  • Date: 2017-07-24 19:46:07
  • Type: question
  • Quality Score: 7/10
  • Reply to: post_00750

๐Ÿท๏ธ Tags

macro hotkeys beginner solved

  • Stack Key Editor
  • Python Scripting
  • Macro Editor

๐Ÿ’ฌ Content

yan.kansky:

roaoao, Iโ€™m trying to make a button to move selected objects to center. It works if I type this text in โ€œCommandโ€:

bpy.context.object.location[0] = 0

[ATTACH=CONFIG]489161[/ATTACH]

but for active object only. What do I need to add to the command to make it move not just one but all selected objects to center on one axis?

draguu:

try this with stack keys in command tab

for i in bpy.context.selected_objects: i.location[0] = 0

this one is for X axis , change i.location[0] tp i.location[1] for Y axis , and i.location[2] for z axiz ,
and to make it all in center , i.location = [0,0,0]

Hope this works

draguu , thank you very much, it worked like a charm! :slight_smile:


โค๏ธ 1 likes


๐Ÿ”— View on Blender Artists