CoolFace
Datasetpublic

HuggingAI4Engineering/cadgenbench-data

CADGenBench (Inputs) Public inputs for the CADGenBench benchmark, which measures how well AI systems produce correct 3D mechanical parts as STEP files. This repository holds the task inputs only; the ground truth is withheld in a separate private repository so that the leaderboard's evaluation is the single source of truth. Leaderboard Space: HuggingAI4Engineering/CADGenBench Browse the tasks: the Tasks tab on the Space (thumbnails, search, generation/editing filter, per-task… See the full description on the dataset page: https://huggingface.co/datasets/HuggingAI4Engineering/cadgenbench-data.

sourceHugging Faceodc-byupdated 4mo agoView on Hugging Face
6likes8.6kdownloads
sanity_check_submission.py79 linesDownload Raw Back to root
1#!/usr/bin/env python2"""Local self-check for a benchmark submission STEP.3 4Runs the same CAD-validity gate that the grading pipeline uses: BREP5well-formedness + watertightness + meshable-as-closed-manifold. Exits6non-zero on any failure with the specific reason; exits 0 silently on7a clean submission.8 9Usage::10 11    python _to_move_to_dataset_repo/sanity_check_submission.py path/to/output.step12 13The gate is the deciding factor for whether ``cad_score = 0``. See14``docs/benchmark/submission.md`` for the full contract.15"""16from __future__ import annotations17 18import argparse19import sys20from pathlib import Path21 22from cadgenbench.common.validity import analyze_step23from cadgenbench.common.mesh import deflection_for_bbox24 25 26def main() -> int:27    parser = argparse.ArgumentParser(28        description=(29            "Run the CAD-validity gate on one candidate STEP. Same gate "30            "the grading pipeline uses."31        ),32    )33    parser.add_argument("step", type=Path, help="Path to the candidate STEP file.")34    parser.add_argument(35        "--quiet", action="store_true",36        help="On pass, exit silently. On fail, still print the reason.",37    )38    args = parser.parse_args()39 40    if not args.step.exists():41        print(f"ERROR: file not found: {args.step}", file=sys.stderr)42        return 243 44    try:45        result = analyze_step(args.step)46    except Exception as exc:47        print(f"FAIL  STEP load failed: {exc}", file=sys.stderr)48        return 149 50    val = result.validation51    m = result.measurements52 53    if val.is_valid:54        if not args.quiet:55            defl = deflection_for_bbox(m.bounding_box.diagonal)56            print(57                f"PASS  {args.step.name}: is_valid=True watertight=True\n"58                f"      solids={m.solid_count} shells={m.shell_count} "59                f"faces={m.face_count}\n"60                f"      volume={m.volume:.2f}  bbox="61                f"{m.bounding_box.size_x:.2f}×{m.bounding_box.size_y:.2f}×"62                f"{m.bounding_box.size_z:.2f}  defl_used={defl:.4f} mm",63            )64        return 065 66    print(67        f"FAIL  {args.step.name}: is_valid=False  watertight={val.is_watertight}",68        file=sys.stderr,69    )70    for err in val.topology_errors[:10]:71        print(f"      - {err}", file=sys.stderr)72    if len(val.topology_errors) > 10:73        print(f"      ... and {len(val.topology_errors) - 10} more", file=sys.stderr)74    return 175 76 77if __name__ == "__main__":78    raise SystemExit(main())79