Grows a branching structure from a trunk you draw — a tree in elevation for a landscape drawing, or the same machinery turned to other uses: a wiring diagram, a decision tree, a river system.
What TreeGrow does
FRACTREE every branch splits the same way every time, so the result
is regular and symmetrical - the classic fractal tree
PLANTGROW the split angles wander, so no two branches match and the
tree looks as though it grew rather than being drawn
How to use it
- Load the routine with
APPLOAD, or put it on your support file search path. - Draw the trunk as a line.
- Type
FRACTREEorPLANTGROW. - Pick the trunk, give the split angle, the shortening factor and the number of rounds.
- Check the reported line count before letting it draw.
How it works
Start with a trunk. At its far end, sprout branches at a set angle either side and one straight on, each shorter than the trunk by a fixed factor. Then do the same to every one of those.
The number of branches multiplies by three each round, so six rounds is over a thousand lines and nine is near thirty thousand — which is why the count is capped and reported before anything is drawn.
The trunk is the one you pick, not whatever object happened to be drawn last.
PLANTGROW has a proper random generator. The original took its random angles from
(setq s (* (getvar "cdate") 10000000.0))
(setq s (* pi (- s (fix s))))
CDATE is the date and time as YYYYMMDD.HHMMSS — it changes once a second. Inside a loop that runs in microseconds it returns the same value over and over, so every branch in a generation took the identical angle and the “random” tree came out as a fan of straight lines.
No block is needed and no named view is left behind. The drawing colour is put back, and a deep run cannot end up asking for colour 200-something.
Notes and limits
- Branches triple each round. Six rounds is over a thousand lines.
- The count is reported before anything is drawn.
- Two commands: regular and irregular.
- One undo group covers the tree.
Download and details
| Name | TreeGrow — grow a branching tree from a trunk you draw |
| Download | TreeGrow.lsp — 9.3 KB, plain AutoLISP source. Downloads directly; no zip to unpack. |
| Type | AutoCAD AutoLISP routine |
| Commands | FRACTREE, PLANTGROW |
| Requires | nothing beyond a CAD platform with AutoLISP. |
| Source size | 9.3 KB, 233 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
- HILBERT LISP — space-filling curves from the same family
- HANOI LISP — recursion you can watch
- 5 crazy things to do with AutoLISP — more of the same spirit
- More free AutoLISP routines on this site
- Wisey’s Steel Shapes — free structural steel section drawing program