- 扩展 CDSL engine 的 shell、sweep、loft、reference plane、pattern 等运行时能力, 支持新的实体结果模式、双向拉伸、曲线扫掠、镜像/圆周阵列及相关 selector 解析。 - 完善 Build123d 适配层的拓扑快照、Compound/ShapeList 兼容处理和旋转曲面识别, 兼容 Python 3.12 / 当前 Build123d 缺少 axis_of_rotation 的合法曲面场景。 - 扩展 CDSL schema、profile schema、capability analysis、semantic validation 和 sketch solver,使新增建模操作能够被校验、执行并保留可诊断的部分结果。 - 完善 CADFS FeatureScript lowering: 支持 shell、sweep、surface/实体 loft、圆周阵列副本、镜像副本、删除阵列实例、 新 body 操作、更多拉伸终止条件和 reference plane 变体。 - 补齐椭圆、B-spline、环形区域、imprint、SWEPT_FACE、CAP_FACE、OFFSET_FACE 等 草图和拓扑引用的转换逻辑,改善后续特征的工作平面、轴线和 profile 定位精度。 - 改进 selector binding:支持 pattern 前缀复合 B-rep 快照、交集顶点引用、 多面 match_mode=all、圆柱轴线/半径和面积下限等稳定匹配条件。 - 修复 MID_PLANE 法向统一后交线方向未同步的问题,恢复 00287955 基准面的正确位置; 修复 00542223 sweep 路径反转后的切线契约和 00423838 的拓扑面数不稳定测试假设。 - 修正 CADFS 比较模块 import 路径,补充重建报告、批量重建脚本、目标文档和 README。 - 新增并扩展 engine、lowering、parser、selector binding、reports、integration 和 Onshape pipeline 回归测试,覆盖代表性 CADFS 特征链及运行时兼容性。
Onshape to CDSL
This package produces an auditable CDSL dataset from official public Onshape Part Studio URL mappings. It never treats a feature tree as sufficient proof: each accepted record has its complete raw API evidence, original AP242 STEP, CDSL-only rebuilt STEP, and an independent strict geometry report.
scan -> select -> download -> convert -> validate -> dataset/<id>.cdsl.json
Run from the repository root. The only runtime path setup needed is the engine and this source package; no new packaging tool is introduced.
export ONSHAPE_ACCESS_KEY='...'
export ONSHAPE_SECRET_KEY='...'
export PYTHONPATH=backend/engine:onshape_to_cdsl/src
python -m onshape_to_cdsl scan --url-file /path/to/objects.yml --limit 500 --workers 1
python -m onshape_to_cdsl select --count 100 --seed 0
python -m onshape_to_cdsl download
python -m onshape_to_cdsl convert
python -m onshape_to_cdsl validate
To find more than one URL range yields, scan non-overlapping batches and merge them before deterministic selection:
python -m onshape_to_cdsl scan --url-file objects_0000.yml --offset 0 --limit 500 --out data/scan/00000.json
python -m onshape_to_cdsl scan --url-file objects_0000.yml --offset 500 --limit 500 --out data/scan/00500.json
python -m onshape_to_cdsl merge-scans --scan data/scan/00000.json --scan data/scan/00500.json --out data/scan/merged.json
python -m onshape_to_cdsl select --scan data/scan/merged.json --count 100 --seed 0
For hosts that limit foreground process duration, download the deterministic selection in resumable batches. Existing artifacts are reused by SHA-256:
python -m onshape_to_cdsl download --offset 0 --limit 3
python -m onshape_to_cdsl download --offset 3 --limit 3
Or run all stages in sequence:
python -m onshape_to_cdsl run --url-file /path/to/objects.yml --scan-limit 500 --scan-workers 1 --count 100 --seed 0
--url-file accepts id URL, id: URL, and the same-line ID/URL records in
ABC objects_*.yml. URLs are deliberately not hard-coded in the repository.
Credentials are read from ONSHAPE_ACCESS_KEY/ONSHAPE_SECRET_KEY or hidden
terminal prompts, and are never written to files or logs.
The official ABC mapping archive is published by NYU as
abc_objects_00-49.7z and abc_objects_50-99.7z. Each contained
objects_*.yml file has 10,000 URLs. Start with --scan-limit 500; the
pipeline stratifies those API-inspected candidates and selects 100 complete
downloads. The client honors 429 Retry-After responses; use one scan worker
unless the API quota explicitly permits higher concurrency.
All generated data lives in ignored onshape_to_cdsl/data/:
scan/manifest.json feature classifications for all source URLs
selection/manifest.json deterministic, stratified selected candidates
raw/<id>/ complete public API responses, meshes, STEP and hashes
converted/<id>/ candidate CDSL, rebuild STEP, conversion/validation reports
dataset/<id>.cdsl.json only strict-validation accepted CDSL
rejected/<id>/ candidate/rebuild/report evidence for every failure
reconstruction_issues.md generated rejection and engine capability work queue
reconstruction_issues.json machine-readable version of the same register
The v1 executable converter intentionally supports only solved newSketch
geometry composed of lines, arcs and circles plus standard, one-direction,
no-draft BLIND extrudes (NEW, ADD, REMOVE). The registry audits all
other feature types. Unsupported standard operations are deferred; custom
FeatureScript, imports and external/derived dependencies are
not_admissible. Their raw feature trees, FeatureScript payload, B-rep and
STEP remain in raw/, but they cannot enter dataset/.
Admission uses a separate comparator, not the engine's preview comparator.
It requires bidirectional B-rep surface sample maximum and P99 distances at
most 0.01 mm, six-coordinate bounding-box error at most 0.01 mm, volume
and surface-area relative error at most 1e-5, and equal solid counts.
Topology counts/types are report-only diagnostics because kernel exports may
split equivalent faces differently.
validate regenerates reconstruction_issues.md on every run. It classifies
each failure as a source dependency limitation, converter gap, engine
capability gap, engine execution failure, or strict geometric regression, and
adds engine-specific blockers to an explicit implementation work queue.