Files
make-cad/docs/updates/2.1.2.md
T
NiJingzhe aac0fbb29d feat(cache): script-anchored part cache, keyword-form corpus, 2.1.2
- @scad.part/@scad.assemble anchor defaults to the builder script's own
  directory: cache + interface state land beside the source, standalone
  scripts run anywhere, and the pyproject.toml walk-up requirement is
  gone (explicit project_root still relocates the anchor)
- file_input() paths resolve relative to the anchor; in-repo examples
  rewritten to script-relative declarations
- HistCAD translator emits keyword-form sketch-family calls (corpus
  self-documentation), pinned by tests; booleans stay positional by
  *solids signature
- both translators emit project_root=Path(__file__).parent explicitly;
  examples/histcad_demo regenerated (STEP volume reconciliation held)
- FTC convention documents @scad.part parameters and the cache contract
- version stamps 2.1.2 + bilingual update notes
2026-09-10 00:11:28 +08:00

55 lines
2.7 KiB
Markdown

# 2.1.2 Update Notes
> **Release notice:** Validate generated definitions, assembly constraints, and
> manufacturing geometry before production use.
## Script-anchored part cache (SDK behavior change)
The `@scad.part` / `@scad.assemble` anchor is now the directory containing the
builder's source file. The content-addressed part cache and the part interface
state land at `<script dir>/.simplecad/` by default:
- A standalone script runs from anywhere — no `pyproject.toml` is required up
the tree, and a missing project root no longer fails at decoration time.
- Copying or deleting a script directory carries or clears its cache with it.
- `file_input()` paths resolve relative to the anchor; scripts typically
declare their inputs next to themselves (`scad.file_input("model.py")`).
- Pass `project_root=...` explicitly to anchor at a larger project — the
project-level cache and the `[tool.simplecadapi.cache]` table follow the
explicit anchor. Environment overrides (`SIMPLECAD_CACHE_DIR`,
`SIMPLECAD_CACHE_MODE`, …) are unchanged.
## Keyword-form translator corpus
All sketch-family calls emitted by the HistCAD→FTC translator are now
keyword-form (`scad.add_circle_rsketch(sketch=s, entity_id=..., center=...,
radius=...)`, `scad.constrain_distance_x_rsketch(sketch=s, a=..., b=...,
value=...)`). Translated sources are training corpus: the parameter names
carry the meaning in the source itself. The same pin already guarded the
CadQuery translator; both suites now reject positional sketch-family calls
(boolean `*solids` varargs stay positional by signature).
## Explicit cache anchor in emitted sources
Both translators (histjson, cadqueryftc) emit
`project_root=Path(__file__).parent` on `@scad.part` explicitly, so a
delivered `.ftc.py` states where its cache lands instead of relying on
implicit resolution. The three `examples/histcad_demo` sources were
regenerated; STEP volume reconciliation is unchanged (1.63e-16 / 8.18e-05).
## FTC convention: `@scad.part` parameters and the cache
`docs/skill/references/discipline/feature-tree-convention.md` gains a section
documenting the decorator's keyword parameters (`id`, `revision`, `inputs`,
`cache`, `project_root`, `tolerance_profile`), where the cache and interface
state land, the override chain (decorator > environment > project config >
defaults), and the cache key composition.
## Compatibility notes
- Builders relying on the old implicit project-root walk-up (shared
`<repo>/.simplecad`) now get a script-local cache instead; pass
`project_root=...` explicitly to keep the old anchoring.
- In-repo examples that declared repo-root-relative `file_input` paths were
rewritten to script-relative paths in this release.