Two useful scripts to do with vertex alignment

Script 1: Align Verts to Grid
http://members.cox.net/vexgames/vertgrid/vertgrid.py

The first script automatically moves all vertices of a mesh, or a curve (of any type) to the nearest multiple of a value you specify.

It remembers this value, so next time you can click ok.

This allows you to draw freehand shapes, or move things around freehand (generating errors where things dont quite align with grid), and then just activate the tool to automatically clean up for you:

Before:
http://members.cox.net/vexgames/vertgrid/before1.gif
After: (Granularity was set to 1.0)
http://members.cox.net/vexgames/vertgrid/after1.gif

You can use it on NMESHES in 3d also. The results are strange.

Before:
http://members.cox.net/vexgames/vertgrid/before2.gif
After: (Granularity was set to 0.25)
http://members.cox.net/vexgames/vertgrid/after2.gif

This is obviously meant for architectural, or angular objects, which you might have freehanded, or moved slightly out of alignment.

It performs on all vertices of the object. (Not selecteds). This is intentional, as I wrote it for internal use on architectural extruded models, to be able to select all the models in a scene and activate it.

The tool will appear in the scripts menu when in object mode.
You can activate it in mesh mode without it malfunctioning, though.


Script 2: Move object so vertex is at 3D cursor position
http://members.cox.net/vexgames/alignpy/vert_to_cursor.py

The tool will appear in the scripts menu when in object mode.
You can activate it in edit mode without it malfunctioning (I usually do it that way).

To use it, move the 3d cursor somewhere, then select a vertex of a mesh. (Meshes only - not curves yet, still working on that).
Activate the script.

This will move the OBJECT such that the vertex is moved to the point the 3d cursor is at.

Note - the object is moved, not the vertex, or the vertices. The script basically computes how far the vertex would have moved, and then moves the entire object that much. The end result is that the vertex you had selected is at the 3d cursor, the mesh hasn’t been changed or distorted:

BEFORE:
http://members.cox.net/vexgames/alignpy/before1.gif
AFTER:
http://members.cox.net/vexgames/alignpy/after1.gif

BEFORE:
http://members.cox.net/vexgames/alignpy/before2.gif
AFTER:
http://members.cox.net/vexgames/alignpy/after2.gif

Note that the script is clever enough to be able to do it regardless of the scale/position/rotation of the object… and works on parented objects such in the second set of before afters above (the monkey is rotated strangely and is parented to a rotated translated sphere, but the vertex selected still ends up exactly at the cursor).

Thanks for looking at this. I’m refining these scripts, but feel free to use them for whatever.

Well… thanks, but is that not already possible with the shift-S menu?

If I want to align vertices to the grid, with a mesh like in your example, I just type shift-S and then 1. If I want to change grid resolution, to snap more finely, I set the grid spacing in the View Properties requester.

Yes. This does the same thing… without having to go into the view menu. I wrote this mainly because I do this in batches, and often in varying sizes. Its mainly a batch tool because it can apply it to every object in the scene, vert-by-vertex, instead of just one object at a time (which is what you get if you are in mesh-mode and use shift-s).

I do a lot of angular architectural style stuff, and its mainly for sanity checking.

Thanks for that method though! I’ll definitely be using it on an individual object basis.

The second script is still very useful though ( I haven’t found a part of blender that does this yet).

What I’d really like to do is make a version of that second script which works in UV mode, where you could perhaps select an edge and auto weld it to another edge (of a different island) but it’d automatically move/rotate the islands to match…