# Shortcut for setting origin to vertex

I find myself doing the following quite often:

1. go into edit mode
2. select a single vertex
3. press Space to enter the search menu
4. type cur
5. select Set cursor to active

6. leave edit mode
7. press Shift+Ctrl+Alt+C to get the set origin choices
8. Choose Set origin to 3D cursor

This seems like a very tedious process to me. I'm sure there's a shorter version of setting the origin to a vertex. Please tell me how to make this process more efficient.

I am open to installing an Addon if necessary.

• OK, but I hope somebody will give a more complete answer, because i do this steps quite often too and a way to automate it would be handy. – thibsert Mar 16 '19 at 12:29
• I don't think there is any built-in way as of 2.79. There were talks it will be In 2.8. With addons it can be made faster, like with Dynamic Context menu (built-in one), see blender.stackexchange.com/a/71319/1245. There are also some 3-rd party addons as well though their workable state is to be checked – Mr Zak Mar 16 '19 at 12:55
• – batFINGER Mar 16 '19 at 17:43
• lol, don't be sorry.. I love that question (and especially the deleted answer) it appeals to my warped SOH. Post it whenever I'm given the opportunity. – batFINGER Mar 16 '19 at 19:08

Steps 3/4/5 can be replaced by Shift+S (for Snapping) / O.

Step 8 can be replaced by T. In general, you can look for underlined letters in such menus.

I also wrote an add-on to automate the process: OriginToSelection.py.

Install the add-on via User Preferences / Add-ons / Install from file, don't forget to activate it (check the box before its name). Press Spacebar and search Origin, then select Origin To Selection.

Be careful, I'm new to publishing add-ons and I'm pretty sure it can cause crashes. Save your work before using!

• The plugin is cool. Works fine so far. – Thomas Weller Mar 16 '19 at 13:30
• It works but is insecure (ie, it drops an error if used in Object mode), and i can't guarantee it won't crash Blender. Using Dynamic Context as suggested by Mr Zak seems way better (and it's build-in). – thibsert Mar 16 '19 at 13:39
• I wonder why the bother with the context overriding in your addon. Consider having it poll only when in 3d view and edit mode. As it is it will fail silently when run when no 3d views in screen. – batFINGER Mar 16 '19 at 15:29
• I still don't understand that context thing really well. Before packing it as an addon I was running it trough the script window, so the overriding was necessary (I think?). You say it's safe to remove it ? Edit : it works well without it, thank you! – thibsert Mar 16 '19 at 15:35
• Can override going the other way when testing in the text editor, ie if __name__ == "__main__": bpy.ops.my_new.operator(ctx, 'INVOKE_DEFAULT') – batFINGER Mar 16 '19 at 19:32

Little bmesh helper script.

The process to move the origin involves making the new point the origin by subtracting it from all other verts, effectively making the point origin (0, 0, 0),

Finally translate the matrix world of the object, in the opposite direction, such that the global location of vertices stays the same, ie move the object by the difference in global coordinate of the point to the former origin.

mw.translation += mw @ pt - mw @ Vector()


or since mw @ Vector() == mw.translation can set the translation to

mw.translation = mw @ pt


Run in edit mode. Moves origin to selected geo.

import bpy
import bmesh
from mathutils import Vector
context = bpy.context

ob = context.edit_object
mw = ob.matrix_world
me = ob.data
bm = bmesh.from_edit_mesh(me)

selverts = [v.co for v in bm.verts if v.select]
if len(selverts):
pt = sum(selverts, Vector()) / len(selverts)
#T = Matrix.Translation(-pt)
bmesh.ops.translate(bm, vec=-pt, verts=bm.verts)
mw.translation = mw @ pt # replace @ with * for 2.7x
bmesh.update_edit_mesh(me)


• Without testing (library upgrades for 2.80 have bombed my 2.79 build, too lazy to fix atm) Pretty sure the required changes to make it work for 2.7x is replacing any @ with * and change the version accordingly in bl_info – batFINGER Mar 16 '19 at 19:16