CoolFace
Datasetpublic

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.

sourceHugging Facecc0-1.0updated 3mo agoView on Hugging Face
1likes1.5kdownloads
Dataset Card

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)

bash
pip install datasets
python
from 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

bash
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-1k

Python Hub API (selective download)

python
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:

Config suffixContentFile format
(none)CadQuery source + metadataJSONL
-renders+ 8 shaded render imagesParquet (render_* = image)
-stl+ binary STL meshParquet (stl_bytes = binary)
-step+ binary STEP B-repParquet (step_bytes = binary)
-geo+ renders + STLParquet
-full+ renders + STL + STEPParquet

Complexity-tier slices

Every content variant above is published along a second axis so you can exclude the highest-complexity parts without filtering yourself:

Tier sliceConfig formTiers included
All tiers{tag}{suffix} (e.g. 1k, 1k-renders)0–3
Tiers 0–2{tag}-t0-2{suffix} (e.g. 1k-t0-2, 1k-t0-2-renders)0, 1, 2
python
# 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

TagPartsSeedAvailable configs
1k1,0002202201k, 1k-renders, 1k-stl, 1k-step, 1k-geo, 1k-full, 1k-t0-2, 1k-t0-2-renders, 1k-t0-2-stl, 1k-t0-2-step, 1k-t0-2-geo, 1k-t0-2-full
2k2,0002202202k, 2k-renders, 2k-stl, 2k-step, 2k-geo, 2k-full, 2k-t0-2, 2k-t0-2-renders, 2k-t0-2-stl, 2k-t0-2-step, 2k-t0-2-geo, 2k-t0-2-full
5k5,0002202205k, 5k-renders, 5k-stl, 5k-step, 5k-geo, 5k-full, 5k-t0-2, 5k-t0-2-renders, 5k-t0-2-stl, 5k-t0-2-step, 5k-t0-2-geo, 5k-t0-2-full
10k10,00022022010k, 10k-renders, 10k-stl, 10k-step, 10k-geo, 10k-full, 10k-t0-2, 10k-t0-2-renders, 10k-t0-2-stl, 10k-t0-2-step, 10k-t0-2-geo, 10k-t0-2-full
20k20,00022022020k, 20k-renders, 20k-stl, 20k-step, 20k-geo, 20k-full, 20k-t0-2, 20k-t0-2-renders, 20k-t0-2-stl, 20k-t0-2-step, 20k-t0-2-geo, 20k-t0-2-full
50k50,00022022050k, 50k-renders, 50k-stl, 50k-step, 50k-geo, 50k-full, 50k-t0-2, 50k-t0-2-renders, 50k-t0-2-stl, 50k-t0-2-step, 50k-t0-2-geo, 50k-t0-2-full
100k100,000220220100k, 100k-renders, 100k-stl, 100k-step, 100k-geo, 100k-full, 100k-t0-2, 100k-t0-2-renders, 100k-t0-2-stl, 100k-t0-2-step, 100k-t0-2-geo, 100k-t0-2-full

Schema

All configs include:

ColumnTypeDescription
part_idstringUnique deterministic identifier
familystringplate, bracket, revolved, block, compound, sketched, flanged, ribbed, enclosure, profiled, lofted, swept, tapped, gear, threaded
tierint32Complexity tier 0–3
seedint64Per-part seed
symmetrystringDetected symmetry class
op_countint32Number of CadQuery operations
ir_hashstringSHA-256 of the canonical IR (dedup key)
generator_versionstringCadQuarry version
licensestringAlways CC0-1.0
geometry_signaturestring (JSON)Volume, surface area, face/edge/vertex counts
dimensionsstringProcedural human-readable dimension summary (prompt-friendly)
sourcestringFull .py CadQuery program
paramsstring (JSON)Typed parameter schema with ranges and defaults

Geometry columns (geometry variants only):

ColumnTypePresent in
render_frontrender_iso_blimage-renders, -geo, -full
stl_bytesbinary-stl, -geo, -full
step_bytesbinary-step, -full

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:

bash
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:

bash
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:

python
PARAMS: dict[str, dict]          # typed parameter schema
def build(p: dict) -> cq.Workplane: ...

Run a part with CadQuery installed:

python
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")