Skip to main content

BrickNet: Graph-Backed Generative Brick Assembly

Peter Kulits and Cordelia Schmid

CVPR 2026

[Project Page] | [Models] | [Dataset]

BrickNet teaser

Updates

26-10-01 -- Convex Colliders

Collision checking now uses convex decompositions and Bullet penetration depths with a 1-LDU overlap allowance, replacing triangle-intersection checks on pre-inset meshes. The new checker is strongly recommended for new work. To reproduce the original BrickNet numbers, use v0.1.0.

The new colliders cover 14,442 of the 14,583 catalog parts (99.0%). The API is unchanged. Follow the install commands.

The non-decomposed watertight meshes can be separately downloaded at watertight.tar.xz (80.8 MiB).

Install

pip install bricknet

Collision checking requires the preprocessed per-part convex colliders (191 MiB download, 989 MiB extracted):

python -m bricknet fetch-meshes

Meshes are stored in the platform user-data directory; set BRICKNET_DATA to use another location.

Data Structures

There are three representations:

  • LDR: standard LDraw model text; absolute part poses.
  • Graph: part vocabulary ids, colors, optional absolute transforms, structured connector edges, connected components; persisted as batched .npz.
  • Tree: a quantized spanning tree of one Graph component; a build order. Serialized as path text, the format we train on.
import bricknet

g = bricknet.parse_ldr(open("model.ldr").read())   # LDR -> Graph
t = bricknet.sample_tree(g, 0, method="bfs")       # Graph -> Tree (component 0)
print(bricknet.serialize_tree(t))                  # Tree -> path text

Modules:

  • core: shared types
  • data: catalog and connector loaders
  • tree: the path-text codec
  • collision: the mesh collision kernel
  • graph: parsing, sampling, realization, .npz I/O
  • score: parse/collision evaluation of generated samples

Generation

scripts/generate.py requires torch transformers accelerate peft.

Unconditional generation with a PT model:

python scripts/generate.py --model Qwen/Qwen3-0.6B --lora kulits/BrickNet-0.6B-PT \
    --output out.jsonl --num_samples 2048 --batch_size 128 --stop_after_newlines 199

Caption-conditioned generation with an SFT model (the SFT adapter stacks on the PT adapter; the prompts file is a jsonl with a caption field):

python scripts/generate.py --model Qwen/Qwen3-0.6B \
    --lora kulits/BrickNet-0.6B-PT --lora kulits/BrickNet-0.6B-SFT \
    --output out.jsonl --prompts_file prompts.jsonl --batch_size 128

Output rows are {"id", "sample", "text"} with the path text under text.

Score the samples and turn them into viewable models:

python -m bricknet score out.jsonl scored.jsonl
python -m bricknet path2ldr out.jsonl -o models/   # one .ldr per sample

The .ldr files can be opened with an LDraw viewer such as LDView.

Command Line

python -m bricknet sample models/ -o paths.jsonl      # build sequences from .ldr models, --n per component
python -m bricknet sample graphs.npz -o paths.jsonl   # same, from a graph batch
python -m bricknet score samples.jsonl scored.jsonl   # parsability + collision metrics (--no-collision: parse only)
python -m bricknet path2ldr sample.txt -o model.ldr   # generated path text -> viewable LDR
python -m bricknet path2ldr out.jsonl -o models/      # generator output: one .ldr per sample

sample and score read and write the same jsonl row format as the distributed path datasets.

Evaluation

The paper's image--text metrics (PE / SigLIP 2 / VQAScore) are in eval/; see eval/README.md.

Data

The part vocabulary, connector labels, and alias table ship inside the package; the collision meshes are downloaded separately (see Install). The datasets (graphs, captions, and pre-sampled paths) are distributed via a request form; see DATA.md for schemas.

Rendering

Rendering code is distributed separately in BrickNet-Render.

pip install bricknet-render "bpy>=5.1"
python -m bricknet_render fetch-glbs
bricknet-render model.ldr out/views --views 8

Conversions

flowchart LR
  LDR[".ldr text<br/>absolute poses"]
  GRAPH["Graph<br/>parts + connector edges"]
  TREE["Tree<br/>build order, quantized joints"]
  PATH["path text<br/>a Tree as text"]
  NPZ[".npz<br/>Graphs on disk"]

  LDR   -->|parse_ldr| GRAPH
  GRAPH -->|graph_to_ldr| LDR
  GRAPH -->|"sample_tree / sample_collision_free_tree"| TREE
  TREE  -->|tree_to_graph| GRAPH
  TREE  -->|serialize_tree| PATH
  PATH  -->|parse_sample| TREE
  GRAPH -->|save_graphs| NPZ
  NPZ   -->|load_graphs| GRAPH

Citation

@InProceedings{Kulits_2026_CVPR,
    author    = {Kulits, Peter and Schmid, Cordelia},
    title     = {BrickNet: Graph-Backed Generative Brick Assembly},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2026},
    pages     = {39252-39261}
}

Metadata

Release files for bricknet 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bricknet 0.1.1
File Size Uploaded Provenance Actions
bricknet-0.1.1.tar.gz 478.6 kB Without provenance Details for bricknet-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bricknet 0.1.1
File Interpreter ABI Platform Actions
bricknet-0.1.1-py3-none-any.whl Python 3 none any Details for bricknet-0.1.1-py3-none-any.whl

Total release size: 966.4 kB

Release files / bricknet-0.1.1.tar.gz

Download URL bricknet-0.1.1.tar.gz
Size 478.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8f0692b620b4b4578513047ec89d151c53385da478d9fc2c3d5091864d5d5529
BLAKE2b-256 checksum
How to use checksums
cc9454cf320d1db483ca92d0a3d387ea633eb61820825f145acc04a754aa6ac6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / bricknet-0.1.1-py3-none-any.whl

Download URL bricknet-0.1.1-py3-none-any.whl
Size 487.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc011bf3fc57e2aae56fe4fadf1b819bc3afce9ef8295c2320026f613f502fcb
BLAKE2b-256 checksum
How to use checksums
86de7abaf953d0cd3e65b1241dd740d22ef7969329856db1c3b64ab435506721
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for bricknet 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page