优化流程

This commit is contained in:
2026-09-02 13:51:35 +08:00
parent 97a03c290b
commit f3eb5dff54
71 changed files with 5290 additions and 515 deletions
+40
View File
@@ -47,3 +47,43 @@ the normalized full source filename. Files that normalize to the same part ID
receive a deterministic relative-path hash suffix, so every input record maps
to a distinct output. When a matching STEP file exists, it is resolved through
the same relative subdirectory as its source record.
## Onshape API samples
`download_onshape_samples.py` downloads raw Onshape v9 feature-list responses
for a small set of public ABC Part Studios. Create a personal API key in the
Onshape developer settings, then keep the credentials out of the repository:
```bash
export ONSHAPE_ACCESS_KEY='...'
export ONSHAPE_SECRET_KEY='...'
python json_to_cdsl/download_onshape_samples.py --count 3
```
If the environment variables are absent, the program prompts without echoing
the values. Output is written under
`json_to_cdsl/input/onshape_api_samples/<abc_id>/features.json`; this input
directory is ignored by Git. Use `--url ID=URL` for another Part Studio or
`--url-file` to read ABC `objects_*.yml` mappings.
## Complete Onshape sample
`download_onshape_complete.py` saves the complete public-API representation
of one Part Studio. It is the appropriate input for building a CDSL converter:
the directory includes the feature tree, sketch definitions and constraints,
FeatureScript representation, parts, body/topology data, mass properties,
tessellations, previews, native Parasolid, STL, and an independently exported
AP242 STEP reference model.
```bash
export ONSHAPE_ACCESS_KEY='...'
export ONSHAPE_SECRET_KEY='...'
python json_to_cdsl/download_onshape_complete.py --id 00000352
```
The result is written to
`json_to_cdsl/input/onshape_complete/00000352/manifest.json`. Every successful
artifact has a byte count and SHA-256 in that manifest. Failed endpoints are
also recorded, rather than silently omitted. This is all data exposed by the
public API for the selected Part Studio; it is not an internal `.onshape`
document backup, which Onshape does not expose as a download format.