jacobjennings/cadquarry
CadQuarry Procedurally generated, execution-validated, fully parametric CadQuery programs and the geometry they produce. Every part is a pure Python function of typed, range-bounded parameters and is reproducible bit-for-bit from a seed. Generator (canonical source): https://github.com/jacobjennings/CadQuarry generator version v0.6.0, config configs/default.toml Code license: Apache-2.0 · Data license: CC0-1.0 Each corpus in this dataset is a convenience artifact: the… See the full description on the dataset page: https://huggingface.co/datasets/jacobjennings/cadquarry.
CadQuarry
Procedurally generated, execution-validated, fully parametric CadQuery programs and the geometry they produce. Every part is a pure Python function of typed, range-bounded parameters and is reproducible bit-for-bit from a seed.
- Generator (canonical source): https://github.com/jacobjennings/CadQuarry generator version v0.6.0, config
configs/default.toml - Code license: Apache-2.0 · Data license: CC0-1.0
Each corpus in this dataset is a convenience artifact: the generator plus the seed ladder is the actual deliverable. Any corpus can be regenerated locally.
Quick start
Python (datasets library)
pip install datasetsfrom datasets import load_dataset
# Code + metadata only (fastest):
ds = load_dataset("jacobjennings/cadquarry", "1k", split="train")
print(ds[0]["source"]) # full parametric CadQuery program
print(ds[0]["family"]) # e.g. "plate", "revolved", "block"
# With 8-view renders (PIL Images):
ds = load_dataset("jacobjennings/cadquarry", "1k-renders", split="train")
ds[0]["render_iso"].show() # isometric view
ds[0]["render_front"].show() # front orthographic
# With STL mesh:
import trimesh, io
ds = load_dataset("jacobjennings/cadquarry", "1k-stl", split="train")
mesh = trimesh.load(io.BytesIO(ds[0]["stl_bytes"]), file_type="stl")
mesh.show()
# Full corpus (renders + STL + STEP):
ds = load_dataset("jacobjennings/cadquarry", "1k-full", split="train")
with open("part.step", "wb") as f:
f.write(ds[0]["step_bytes"])
HuggingFace CLI
pip install huggingface_hub
# Code-only corpus:
huggingface-cli download jacobjennings/cadquarry \
--repo-type dataset \
--include "1k/corpus.jsonl" \
--local-dir ./cadquarry-1k
# All variants for one size:
huggingface-cli download jacobjennings/cadquarry \
--repo-type dataset \
--include "1k/*" \
--local-dir ./cadquarry-1kPython Hub API (selective download)
from huggingface_hub import snapshot_download
local = snapshot_download(
"jacobjennings/cadquarry",
repo_type="dataset",
allow_patterns=["1k/corpus.jsonl", "1k/corpus-stl.parquet"],
)Content variants
Each corpus size ships as six HuggingFace configs so you only fetch what you need:
Complexity-tier slices
Every content variant above is published along a second axis so you can exclude the highest-complexity parts without filtering yourself:
# All tiers (default naming):
ds = load_dataset("jacobjennings/cadquarry", "1k", split="train")
# Tiers 0–2 only:
ds = load_dataset("jacobjennings/cadquarry", "1k-t0-2", split="train")The two slices share the same schema; the -t0-2 slice simply omits every row with tier == 3. Data files live under {tag}/ (all tiers) and {tag}/tier0-2/ (tiers 0–2).
Corpus sizes
Schema
All configs include:
Geometry columns (geometry variants only):
Render views: front, top, right, iso, iso_fr, iso_fl, iso_br, iso_bl. When a corpus was rendered with extra passes, each view also carries render_{view}_normal (view-space normal map), render_{view}_depth (linear depth) and/or render_{view}_edge (feature-edge overlay) image columns.
Reproducibility
Same generator version + seed ⇒ identical corpus bit-for-bit:
pip install -e ".[dev]" # from the generator repo
cadquarry generate \
--seed <seed> --count <count> \
--config configs/default.toml \
--out <output_dir>To regenerate with all geometry:
cadquarry build --sizes <tag> --formats step,stl,render --out datasets/Working with the parametric source
Each source is a standalone Python module with two exports:
PARAMS: dict[str, dict] # typed parameter schema
def build(p: dict) -> cq.Workplane: ...Run a part with CadQuery installed:
import cadquery as cq, json
source = ds[0]["source"]
params = json.loads(ds[0]["params"])
defaults = {k: v["default"] for k, v in params.items()}
ns = {}
exec(compile(source, "<part>", "exec"), ns)
result = ns["build"](defaults)
cq.exporters.export(result, "part.step")