Featured image of post Open-source Lego AI Generator Show HN: AI automatically generates LDraw Lego\nbrick building models

Open-source Lego AI Generator Show HN: AI automatically generates LDraw Lego brick building models

Developer uses AI to automatically generate LDraw code for Lego bricks, open-sourcing the generated models and images.

Core Event Overview

Developer Anteloc debuted an open-source project on Hacker News, showcasing their achievement of using AI to automatically generate LEGO brick assembly models. The project is presented as a web page, allowing users to browse generated results online and download complete model files.

  • Timeline: Development began around December 2025, with the HN debut in October 2026
  • Open-source status: Complete code and models are publicly available via GitHub Pages (anteloc.github.io)
  • Access method: No installation required; browse directly via web page; downloading complete models requires a local viewer
  • Model format: Uses LDraw’s .mpd format (Multi-Part Document)
  • Weight availability: No mention of specific model weight release details

The project page includes images and model download links, with each model retaining metadata records of its generation process.

Technical Approach and Implementation Details

LDraw is a low-level programming language specifically designed to describe LEGO brick assembly relationships—essentially the “assembly language” of the LEGO world. The language encodes each brick’s type, color, 3D coordinates, and rotation angles in text form, and the resulting .mpd files are essentially plain-text code.

The core of this project is not developing a new model, but rather building an AI-Agentic system: through prompt engineering and agent architecture, it guides large language models like ChatGPT and Claude to continuously generate, correct, and optimize LDraw instruction sequences. The system self-improves through iterative feedback, ultimately outputting renderable 3D LEGO structures.

The key contrasts are:

  • Non-human creator attribution: Each model’s text metadata includes a specific AI model signature (e.g., “generated by Claude 3.5 Sonnet”), explicitly identifying AI as the “author”
  • Traceable sub-models: The system records intermediate sub-models and modification history, forming a complete generation lineage

Unexpected data point: The project emphasizes a “non-curated showcase.” This means the vast majority of models have not been human-filtered or refined—they are raw outputs from the AI’s spontaneous generation chain, including numerous trials, failures, and half-finished structures. This stands in sharp contrast to the “best-of” selections typical of conventional AI art exhibitions.

Model Viewing and Ecosystem Support

To facilitate local inspection of 3D results, the developer recommends LDView: a lightweight, open-source LDraw model viewer supporting Windows/macOS/Linux.

The viewing workflow is as follows:

  1. Click on a web page image to download the corresponding .mpd file
  2. Open it with a text editor to view metadata such as author and model history
  3. Load the file in LDView for 3D visualization

The text-based nature of .mpd files gives them unique advantages:

  • Version-control friendly (Git), allowing tracking of brick placement changes
  • Easy for programs to generate and modify, forming the basis of a “native CI/CD for LEGO”
  • Can be seamlessly compiled and rendered by other LDraw toolchains (such as LPub3D, Studio)

The current web page has integrated the official LDraw parts library index, ensuring that generated brick types and colors are valid and available.

Practical Usage Recommendations

Users who should try it now:

  • LEGO enthusiasts: Can download AI-generated models for online assembly and experience novel design approaches
  • LDraw beginners: Quickly grasp LEGO assembly syntax by reading generated code
  • AI creators: Reproduce the agent prompt chain and explore state management techniques in low-level code generation

Users who should hold off:

  • Those needing ready-to-use LEGO instructions: Most models are not in a directly printable/assemblable state and require manual secondary filtering
  • Users with zero LEGO background: LDraw has a steep learning curve; recommended to start with official .parts files to familiarize yourself with basic brick types

If you want to build a similar system yourself, the core challenges are:

  • A carefully designed LDraw Prompt Chain (how to constrain syntax and prevent drift)
  • Fine-grained failure detection mechanisms (e.g., missing brick collision detection)
  • Sub-model reuse and reference logic

Final Thoughts

The value of AI-generated LEGO models lies not in replacing human design, but in expanding creative boundaries—when AI can produce thousands of raw configurations, human filtering, combination, and redesign will become the new hub of creativity. LDraw’s text-based nature makes it an ideal interface for AGI to interact with the physical world.

This project continues the spirit on HN of “using AI to write code that generates the physical world”—from chip design to robotic structures, the future looks promising.