3dd8c77b8d
A SimpleCAD model is now a marimo notebook: a PEP 723 header with a [tool.simplecadapi] table (id, revision, tolerance_profile, inputs), one FTC block per cell, and the product is the top-level value whose id is the notebook id. The notebook file is the only source of truth; .scadpkg is only for exchange and publishing. Runtime (simplecadapi.runtime): - run_notebook(path, *, id=None, overrides=None, cache=True) and sca run <notebook.py> [--id] [--set NAME=VALUE] [--no-cache] [--out] - use(path, id=..., **overrides) composes child notebooks; notebook_id() lets one notebook serve a part family under per-use ids - each cell records into its own session; cells are the unit of caching, keyed by the notebook dependency digest (deps.json) - marimo cell executor entry point, so marimo edit runs the same way - shapes and read-only definition mappings pickle for the cell cache Removed: the content-addressed part cache (simplecadapi.cache, CachePolicy, CacheReport, sca cache ...), the incremental assembly solver and its dependency/state modules, and part-interface diffs with latest- state persistence. Part and assembly builds and the notebook projection now share one definition writer (build/definition.py). Co-Authored-By: Claude Code <noreply@anthropic.com>
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
import simplecadapi as scad
|
|
from simplecadapi.artifacts.brep import read_brep_solid, write_brep_bytes
|
|
|
|
|
|
def test_geometry_interface_hash_is_independent_of_brep_bytes_and_build_identity():
|
|
first = scad.make_box_rsolid(width=2.0, height=3.0, depth=4.0)
|
|
independently_built = scad.make_box_rsolid(width=2.0, height=3.0, depth=4.0)
|
|
round_tripped = read_brep_solid(write_brep_bytes(first))
|
|
changed = scad.make_box_rsolid(width=2.1, height=3.0, depth=4.0)
|
|
|
|
first_interface = scad.geometry_interface_fingerprint(first)
|
|
|
|
assert first_interface == scad.geometry_interface_fingerprint(independently_built)
|
|
assert first_interface == scad.geometry_interface_fingerprint(round_tripped)
|
|
assert first_interface != scad.geometry_interface_fingerprint(changed)
|
|
assert first_interface != "sha256:" + write_brep_bytes(first).hex()[:64]
|
|
|
|
descriptor = scad.geometry_interface_descriptor(first)
|
|
assert descriptor["body_count"] == 1
|
|
assert descriptor["face_count"] == 6
|
|
assert descriptor["edge_count"] == 12
|
|
assert descriptor["vertex_count"] == 8
|