Skip to content

ll_brepnet — Overview

ll_brepnet is a B-Rep face-segmentation neural network. It operates directly on the boundary representation of a CAD solid — faces and edges connected through oriented coedges (half-edges carrying next / previous / mate / parent-face / parent-edge adjacency) — and fuses that topology with UV-grid surface and curve geometry to predict a semantic segment label for every face.

It is an independent, MIT-licensed package built on the toolkit’s own B-Rep machinery (cadling). It is inspired by BRepNet (arXiv:2104.00706) and UV-Net, but contains no code from those projects — see ll_brepnet/ATTRIBUTION.md.

ModuleResponsibility
ll_brepnet.pipelines.extract_brepnet_data_from_stepSTEP → unit-box scale → coedge graph + per-face/edge features + UV-grids → .npz
ll_brepnet.pipelines.extract_brepnet_data_from_jsonSame record from a precomputed JSON topology
ll_brepnet.pipelines.build_dataset_file / quickstartManifest building (split + train-only standardization); Fusion 360 orchestration
ll_brepnet.dataloadersBRepDataset, offset-aware brep_collate_fn, MaxNumFacesSampler, BRepDataModule
ll_brepnet.modelsUV-Net surface/curve encoders + the LLBRepNet LightningModule
ll_brepnet.train / ll_brepnet.evalpytorch-lightning training; folder/checkpoint inference → per-face logits
STEP solid
→ unit-box scale → coedge graph (next/prev/mate/face/edge incidence)
→ per-face features (surface-type one-hot + area) + face UV-grid [7,U,V]
→ per-edge features (curve-type one-hot + length + convexity) + edge U-grid [6,U]
UV-Net surface/curve encoders ⊕ scalar features
│ (gather per coedge: face_repr[c2f] ⊕ edge_repr[c2e] ⊕ reversed)
coedge message passing (BRepNetEncoder, reused from cadling) → coedge→face mean pool
per-face segmentation head → [num_faces, num_classes]

Trained on the full official split of the Fusion 360 Gallery segmentation dataset (s2.0.0) — 27,282 train / 3,032 validation / 5,366 test solids, the official 8 manufacturing-feature classes, 30 epochs on an Apple-Silicon GPU (MPS).

Held-out test split (5,366 real solids):

MetricValue
mean IoU (macro)0.828
accuracy0.947

Per-class IoU:

ClassIoUClassIoU
Fillet0.98RevolveSide0.83
ExtrudeSide0.93CutSide0.79
ExtrudeEnd0.91CutEnd0.74
Chamfer0.89RevolveEnd0.55

These are real, reproducible numbers (see Usage) — and 0.828 mIoU exceeds the BRepNet paper’s reported ~0.65–0.72 on s2.0.0, achieved with the MIT-clean reused-coedge-encoder architecture rather than the paper’s kernel convolution. (An earlier 4,800-solid subset run reached 0.709; training on the full set raised it to 0.828 and lifted the rare RevolveEnd class from 0.11 to 0.55.)

A native-MLX port (ll_brepnet/mlx/train_brepnet_mlx.py) reproduces the exact architecture — UV-Net encoders with BatchNorm + the coedge message-passing encoder (input projection, residual coedge convolutions with LayerNorm, output projection) — and converts the real trained checkpoint into MLX. Driving both models from the same BRepDataset, it is verified at 100% per-face argmax agreement with PyTorch and an identical mIoU (0.835 on the measured subset), so the MLX model is the trained GNN running on Apple Silicon (the conversion handles Conv OIHW→OHWI/OIW→OWI permutes and inference-mode BatchNorm running stats):

Terminal window
python ll_brepnet/mlx/train_brepnet_mlx.py --mode parity # convert real weights + verify

Use the sidebar for Installation and Usage.