Lsystem executor

From lamm-mit/scienceclaw · View interactive version

Lsystem executor is an AI agent skill from the GitHub repository lamm-mit/scienceclaw. Execute L-system and shape grammars to produce visual derivations, SVG/PNG renders, and optional STL meshes

How to use this skill

Skill file

L-System Executor

Execute parametric L-system grammars and render the results as images or meshes.

Overview

Takes a grammar definition (axiom + rewrite rules) and produces:

Useful for investigations that produce symbolic growth grammars (urban evolution,

microstructure growth, biological branching) and need a concrete visual artifact.

Usage

From a JSON grammar file:

python3 {baseDir}/scripts/lsystem_render.py --grammar grammar.json --steps 4 --output output_dir/

Inline grammar:

python3 {baseDir}/scripts/lsystem_render.py \
  --axiom "A" \
  --rules '{"A": "A[+B]A[-B]A", "B": "BB"}' \
  --angle 25 \
  --steps 4 \
  --output output_dir/

With STL export:

python3 {baseDir}/scripts/lsystem_render.py \
  --grammar grammar.json \
  --steps 3 \
  --stl \
  --output output_dir/

Grammar JSON Format

{
  "axiom": "A",
  "rules": {
    "A": "A[+B]A[-B]A",
    "B": "BB"
  },
  "angle": 25.0,
  "step_length": 10.0,
  "length_scale": 1.0,
  "title": "Urban-Material Growth Grammar"
}

Symbols

| Symbol | Meaning |

|--------|---------|

| F | Move forward, drawing a line |

| A-Z (uppercase) | Move forward, drawing a line (also rewritable) |

| f | Move forward without drawing |

| + | Turn left by angle |

| - | Turn right by angle |

| [ | Push position and heading onto stack |

| ] | Pop position and heading from stack |

| ! | Decrease line width |

| > | Multiply step length by length_scale |

Outputs

The script produces in the output directory:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.