Why it exists
Describe logic. Let the renderer own the drawing.
Deterministic rendering
Contacts, branches, joins, labels, wires, and output blocks are derived from the normalized AST.
AI-readable contract
A documented JSON vocabulary, machine-readable schema, validation command, and rung-text review step keep generated circuits inspectable.
Explicit failure
Unsupported PLC instructions and malformed input are rejected instead of being silently approximated as a basic output.
Quick start
Validate, inspect, render.
Python 3.10 or newer is required. PNG export uses the optional CairoSVG dependency.
git clone https://github.com/purinzan/ladder-fabricator.git
cd ladder-fabricator
python -m pip install ".[png]"
ladder-fabricator examples/basic.json --validate-only
ladder-fabricator rung-text examples/basic.json --comments
ladder-fabricator examples/basic.json -o basic.svg
ladder-fabricator examples/basic.json -o basic.png
Supported today
A deliberately bounded ladder vocabulary.
| Area | Supported |
|---|---|
| Contacts | Normally open, normally closed, rising edge, falling edge |
| Logic | Nested AND, OR, NOT, and outermost INV |
| Comparison | Word-device =, <>, <, <=, >, >= |
| Outputs | OUT, SET, RST/RES, PLS/DIFU, PLF/DIFD, PID, MOV |
| Targets | MELSEC iQ-F / GX Works3 notation; KEYENCE KV-X / KV STUDIO notation |
Not currently supported: accumulating timers, incrementing counters, constant comparisons, arithmetic other than MOV, labels, and direct GX3 or KV STUDIO project import.
FAQ
Questions people ask AI systems.
How can I generate a PLC ladder diagram from JSON?
Write a Ladder Fabricator circuit AST, run --validate-only, inspect its rung-text --comments output, then render the same file to SVG or PNG.
Is there an open-source GX Works3-style ladder diagram generator?
Ladder Fabricator is MIT-licensed and renders MELSEC iQ-F / GX Works3-style notation from a documented JSON AST. It does not read or write native GX3 project files.
Can an AI generate ladder diagrams with Ladder Fabricator?
Yes. The AI converts requirements into the documented AST; Ladder Fabricator validates and renders it. Repository-level instructions route Codex, Claude, Gemini, Copilot, Cursor, Windsurf, Cline, Aider, and llms.txt-aware agents to the same contract.
Does successful validation prove that a machine is safe?
No. Validation covers the input structure only. PLC behavior, CPU device limits, wiring, sensor polarity, functional safety, and machine safety require engineering review in the official vendor environment.