Custom AutoLISP Tools for AutoCAD
A personal project developing custom AutoLISP commands to automate repetitive drafting tasks in AutoCAD.
The tools
- Finding similar shapes - automatic detection and selection of geometrically identical entities across the whole drawing
- Selection by layer - instant selection of every object belonging to a given layer
- Break at all intersections - automatic breaking of entities at every point where they cross another object
- and several more utilities tailored to my own workflow
The result
Tasks that previously took dozens of manual clicks now run with a single command - a substantial time saving and fewer mistakes on large drawings.
Why it matters
The project combines my civil engineering background with programming: I understand both what the person at the drawing board actually needs and how to build the tool that solves it.
In action
WALL - Wall drafting
Draws walls as two parallel faces, with corners joining correctly as you go. A faint preview follows the cursor and shows the wall - including how the corner will be mitred - before you click.
Accepts typed coordinates (absolute, relative and polar) with object snaps active.
C- close the outlineU- undo a segmentCheck- verifyTag- register existing lines as a wall
DOOR - Door placement
Places a door from a dynamic block, automatically cutting the opening on both faces of the wall.
The block is reloaded from disk on every run, so a change in the source file reaches the drawing immediately.
- Snaps to a wall, with a preview of the opening
- Or free placement, with a rotation step
I- block information
WIN - Window placement
Same logic as DOOR, for window openings: a dynamic block that automatically cuts the wall on both faces.
- Snaps to a wall with a preview, or free placement
- The block is reloaded from disk on every run
I- block information
LEVEL - Level markers
Level markers from ready-made blocks: floor, window or elevation level.
The size is given in drawing units, not as a multiplier - you state how tall you want the symbol and the scale is derived from the block geometry.
- If the block has attributes, a dialog is built from its own fields
V- edit valuesI- block information
BREAKSEL - Break at every intersection
Breaks every selected object at each point where it intersects another - two crossing lines become four.
Works on lines, circles, arcs, polylines, ellipses and splines.
The drawing looks unchanged: the pieces stay in place. You see it by clicking on a line.
SMARTDIM - Smart dimensioning
One key for every dimension: it recognises what you clicked and starts the right command with the object already selected.
- Line - aligned dimension
- Circle - diameter
- Arc - radius
- Polyline - the segment you clicked
You only point where it should sit.
OUTLINEDIM - Bulk dimensioning
Dimensions an entire selection in one go: each object gets its own dimension, placed on the outside.
- Line - length
- Arc - radius, arc length and angle
- Circle - diameter and circumference
- Polyline - each segment separately, with curved ones measured as arcs
A Box option draws a single rectangle around everything.
ALIGNDIMS - Dimension alignment
Aligns and evenly spaces any number of selected dimensions, using one you point at as the reference.
LabelPoints - Point numbering
Click points one by one: each gets a POINT and an incrementing number.
Numbering follows the station convention - station 2 gives 201, 202, 203.
Continue picks up from the last number used.
LabelPointWithCords - Points with coordinates
Click anywhere and the coordinates of the point are written next to it.
You choose X, Y or both.
MultipleLabelPoints - Bulk point import
Bulk import of points from Excel or a text file, numbered automatically.
In Excel you define the two ranges - e.g. K4:K26 for X and M4:M26 for Y. They do not have to be adjacent columns.
Before drawing, it prints what it read and the range of values.
ROOM - Room areas
Click inside a space: it traces the outline, measures the area, asks for a name and writes a label.
It bridges door openings, so a room with doors is measured correctly. Units follow the drawing (mm/cm/m).
G- gap toleranceT- text heightU- unitsS- area schedule inside the drawingE- export to CSV for Excel
JOINALL - Bulk join
Joins everything you selected in one move, with no source object to pick.
- Polyline - with a gap tolerance, for drawings with small gaps at corners
- Join - keeps a line a line, but requires endpoints that coincide exactly
FINDSHAPE - Find matching shapes
Pick one or more pieces and it finds every identical one in the drawing - wherever it sits, however it has been rotated or mirrored.
AutoCAD's SELECTSIMILAR does not do this: it matches by type and properties, so it catches a 5-metre circle together with a 5-centimetre one just because they share a layer.
Here layer and colour are ignored and only shape and size count - useful for counting how many identical windows you have, or finding duplicates left stacked on top of each other.
DIMLAYER - Dimensions onto one layer
Moves every dimension in the drawing onto a single layer, creating it if it does not exist.
MTL - Move to layer
Moves the selected objects to another layer.
AME - Area measurement
Area measurement.
IMGRID - Images in a grid
Bulk placement of all images in a folder arranged in a grid.
QUICKSECTION - Section line
Quick section line.