GRIDSNAP rounds the coordinates of things already drawn to the nearest multiple of a spacing you give. Snap mode only helps while you are drawing; this is for a drawing that has already gone astray — traced-over scans, imported DXF from a package with different tolerances, or work done with snap off where everything is a thousandth out and nothing quite meets.
What GridSnap does
Give it 1 and every coordinate becomes a whole number. Give it 25 and everything lands on a 25 mm grid.
How to use it
- Save the drawing first. This moves real geometry.
- Load the routine with
APPLOAD, or put it on your support file search path. - Type
GRIDSNAP. - Give the spacing and select the objects.
- Read the reported maximum shift. If it is bigger than you expected,
Uputs it all back in one step.
How it works
Rounding has to work either side of zero, and the obvious method does not. Taking the remainder and then either subtracting it or adding the difference, depending which half of the step it falls in, is right for positive coordinates and wrong for negative ones — because the remainder is negative there.
On a step of 5, a coordinate of −8 should go to −10. The naive version sends it to 0: two whole steps out, and in the wrong direction.
Rounding is done in one step instead — divide, add a half toward whichever side of zero the number is on, truncate, multiply back. That behaves the same on both sides.
Blocks have their insertion point edited directly rather than being moved with the MOVE command. That is both faster on a large selection and cannot be upset by a running object snap pulling the destination somewhere else.
Notes and limits
- This moves real geometry. The largest distance anything shifted is reported at the end, and one
Uundoes the lot. - Lightweight polylines are handled — along with arcs, ellipses, MText, 3D faces and dimensions.
- Negative coordinates round correctly.
- One undo group covers the whole selection.
Download and details
| Name | GridSnap — round existing geometry onto a grid |
| Download | GridSnap.lsp — 10.2 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Command | GRIDSNAP |
| Requires | nothing beyond a CAD platform with AutoLISP. |
| Source size | 10.2 KB, 243 lines |
| Error handling | Yes — a *error* handler restores every system variable it changed, on cancel as well as on error. |
| Undo | The whole operation is wrapped in a single undo group, so one U reverses all of it. |
| Compatibility | AutoCAD (any release with AutoLISP), BricsCAD, ZWCAD, GstarCAD, ProgeCAD and other IntelliCAD-based platforms. AutoCAD LT needs a LISP enabler. No .NET, no ObjectARX, no installer. |
| Author | YZ, August 2026 |
| Licence | Free to use, supplied “as is” with no warranty. |
References
- STRAYHUNT LISP — find geometry at absurd coordinates first
- VERTINJECT LISP — adding vertices while preserving width and bulge
- BASESNAP LISP — justifying block base points
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program