BRepGround / README.md
jhlee11's picture
Clarify OCC executability and target selection semantics
3b963b0 verified
|
Raw History Blame Contribute Delete
5.53 kB
---
license: cc-by-4.0
language:
- en
tags:
- cad
- 3d
- brep
- text-grounding
- arxiv:2603.11831
size_categories:
- 10K<n<100K
pretty_name: BRepGround
configs:
- config_name: default
data_files:
- split: train
path: data/train-*.parquet
- split: validation
path: data/validation-*.parquet
- split: test
path: data/test-*.parquet
---
# BRepGround
Text-based B-Rep primitive grounding data for **Towards High-Fidelity CAD
Generation via LLM-Driven Program Generation and Text-Based B-Rep Primitive
Grounding** (ICML 2026).
[Paper](https://arxiv.org/abs/2603.11831) · [Code](https://github.com/JohanStackk/FutureCAD) · [FutureCAD histories](https://huggingface.co/datasets/jhlee11/FutureCAD)
## Data
Each example consists of **a STEP solid, a text query, and binary labels on its
faces and edges**. One Parquet row stores one CAD state; the queries in that row
share the same labels. Each label corresponds directly to one STEP primitive.
| Split | CAD states | Text queries |
|---|---:|---:|
| train | 51,034 | 153,159 |
| validation | 2,837 | 8,511 |
| test | 2,857 | 8,575 |
The STEP is the solid before the operation in its state ID.
For example, `00133967_chamfer_6` belongs to parent model `00133967`.
State IDs are disjoint across splits. Parent models overlap: train/validation
share 2,039, train/test 2,032, validation/test 272.
`splits.json` uses `train`, `val`, and `test`; Hugging Face Datasets uses
`validation` for the validation split.
## OCC executability and selection semantics
OpenCascade (OCC) has limited robustness for fillet, chamfer, and shell on some
geometries. During dataset construction, referenced edges or faces for which
OCC could not execute the requested operation were filtered out. Consequently,
the released target selection can differ from the original Onshape user action;
for example, some originally selected edges may be absent. The released entity
labels and text queries refer to the retained, OCC-executable target selection.
## Load
```bash
pip install datasets
```
```python
from datasets import load_dataset
dataset = load_dataset("jhlee11/BRepGround")
row = dataset["test"][0]
query = row["queries"][0]
face_labels = row["face_labels"]
edge_labels = row["edge_labels"]
```
Use `streaming=True` to iterate without downloading the entire split first.
| Column | Meaning |
|---|---|
| `id` | CAD state ID |
| `queries` | Text queries sharing the row's labels |
| `face_labels` | One binary label per STEP face, in OCC traversal order |
| `edge_labels` | One binary label per STEP edge, in OCC traversal order |
| `asset_archive` | ZIP shard containing the STEP and label JSON |
| `step_path`, `label_path` | File paths inside the ZIP shard |
`1` marks a target primitive; `0` marks an unselected primitive. Face and edge
indices each start at zero. Repeated oriented occurrences of the same primitive
are counted once, using OCC's `IsSame` identity comparison.
## Download STEP and label files
Download the export script and restore the files:
```bash
hf download jhlee11/BRepGround export_data.py --repo-type dataset --local-dir downloads/brepground
python downloads/brepground/export_data.py --split all --output datasets/grounding
```
Use `--split test` for one split, `--id <state-id>` for one state, or
`--source /path/to/BRepGround` for a local repository. Each ZIP shard contains
up to 2,000 states. Loading Parquet alone reads the labels and paths; the export
script also downloads the STEP files.
```text
datasets/grounding/
steps/<state-id>.step
labels/<state-id>.json
```
Each label JSON contains `query`, `face_labels`, and `edge_labels`; `query`
contains the same strings as the Parquet row's `queries`.
## Read labeled geometry
Label indexing uses **pythonocc-core 7.8.1.1 / OCCT 7.8.1**.
Follow the code repository's [environment setup](https://github.com/JohanStackk/FutureCAD/blob/main/docs/environment.md)
to create the shared `futurecad` environment. Run the following from the code
repository root after exporting the STEP and label files there:
```bash
conda activate futurecad
```
```python
from grounding_brep.step_labels import read_step_labels
sample = read_step_labels(
"datasets/grounding/steps/00133967_chamfer_6.step",
"datasets/grounding/labels/00133967_chamfer_6.json",
)
selected_faces = [f for f, flag in zip(sample["faces"], sample["labels"]["face_labels"]) if flag]
selected_edges = [e for e, flag in zip(sample["edges"], sample["labels"]["edge_labels"]) if flag]
```
The reader loads the STEP with `read_step_file(..., as_compound=True)` and uses
`TopologyExplorer(shape, ignore_orientation=True).faces()` and `.edges()`.
Labels follow these two traversal sequences directly. Read labels before
normalizing, re-exporting, or otherwise modifying the shape.
See [LABELS.md](LABELS.md) for the complete indexing convention.
## Files
```text
data/<split>-*.parquet
assets/<split>-*.zip
splits.json
export_data.py
read_labels.py
requirements.txt
LABELS.md
README.md
LICENSE.md
```
## License
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
## Citation
```bibtex
@misc{li2026highfidelitycadgenerationllmdriven,
title={Towards High-Fidelity CAD Generation via LLM-Driven Program Generation and Text-Based B-Rep Primitive Grounding},
author={Jiahao Li and Qingwang Zhang and Qiuyu Chen and Guozhan Qiu and Yunzhong Lou and Xiangdong Zhou},
year={2026},
eprint={2603.11831},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2603.11831}
}
```