• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
blog.draftsperson.net

blog.draftsperson.net

the art of technical drawing

blog.draftsperson.net

FRACTREE LISP: Branching Trees and Plants in AutoCAD

August 6, 2026

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

  1. Load the routine with APPLOAD, or put it on your support file search path.
  2. Draw the trunk as a line.
  3. Type FRACTREE or PLANTGROW.
  4. Pick the trunk, give the split angle, the shortening factor and the number of rounds.
  5. 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

NameTreeGrow — grow a branching tree from a trunk you draw
DownloadTreeGrow.lsp — 9.3 KB, plain AutoLISP source. Downloads directly; no zip to unpack.
TypeAutoCAD AutoLISP routine
CommandsFRACTREE, PLANTGROW
Requiresnothing beyond a CAD platform with AutoLISP.
Source size9.3 KB, 233 lines
Error handlingYes — a *error* handler restores every system variable it changed, on cancel as well as on error.
UndoThe whole operation is wrapped in a single undo group, so one U reverses all of it.
CompatibilityAutoCAD (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.
AuthorYZ, August 2026
LicenceFree 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

Filed Under: AutoLISP Routines

Primary Sidebar

Subscribe to our Youtube Channel

Post CAD drafting jobs on Freelancer.com. and get some free money to do this.

Categories

  • American Steel Industry (4)
  • AutoCAD Articles & Reference (30)
  • AutoCAD Bugs & Problems (19)
  • AutoCAD Tips (29)
  • AutoCAD Tutorials (54)
  • AutoLISP Routines (328)
  • AutoLISP Tutorials (15)
  • CAD Standards (7)
  • Civil 3D (7)
  • Civil Drafting (4)
  • Dimensions (2)
  • Drafting Funnies (71)
  • Drafting History (9)
  • Drafting Standards (84)
  • Electrical Drafting (2)
  • General IT reference (7)
  • Geometry (15)
  • GIS (2)
  • Hatch Patterns (12)
  • Office Life Hacks (3)
  • PT (1)
  • Revit Tutorials (54)
  • Steel Detailing (14)
  • Structural Drafting (26)
  • Technical Dictionary (61)
  • Useful Website Links (19)

Footer

Free downloads

  • Free AutoLISP routines
  • Free hatch patterns
  • SHX fonts & text styles
  • Numbering LISP collection
  • ISO 3098B font

Reference charts

  • AWS weld symbols chart
  • Steel detailing chart
  • Hole & slot sizes
  • Bolt edge distance
  • ANSI & ARCH paper sizes
  • How to fold an A1 drawing

Useful links

  • CAD blocks (DWG)
  • Revit families
  • structuraldrafter.com
  • cad-corner.com
  • About
  • Privacy policy

Provided for free with no warranty · Log in