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:
After: (Granularity was set to 1.0)
You can use it on NMESHES in 3d also. The results are strange.
Before:
After: (Granularity was set to 0.25)
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.