Files
make-cad/examples/four_bar_linkage/main.py
T
NiJingzhe 237702c7a8 feat(examples): unnumbered self-contained layout with per-example out/
- rename every numbered example (04/08/10/11/7ep scripts, 12/16/20/21 dirs)
  to clean names; each example now writes artifacts to its own out/ folder
- examples/README rewritten as a category index (part / assembly / reverse
  engineering / FEM); stale run_examples.py reference removed
- flange_plate gains the quickstart FTC part (model.py + external verify.py
  + README); u_link/ap242/flange demo builders read the new asset paths
- ap242_gmsh_volume_mesh gains render_views.py for the demo gallery

fix(artifacts): round-trip-stable geometry fingerprint bounds

AddOptimal bounds wobble by one shape-tolerance quantum between a fresh
shape and the same shape read back from BRep bytes, so definitions sitting
on a quantization cell edge failed every package re-validation. Quantize
bounds at a fixed 1e-4 mm grid, far coarser than the wobble; full suite
green (1503 passed). Stored packages captured before this change must be
recaptured.
2026-09-07 05:46:15 +08:00

38 lines
1.0 KiB
Python

"""Build the four-bar linkage and capture its product package."""
from __future__ import annotations
import sys
import time
from pathlib import Path
import simplecadapi as scad
sys.path.insert(0, str(Path(__file__).resolve().parent))
from assembly import build_four_bar_linkage # noqa: E402
OUT_DIR = Path(__file__).resolve().parent / "out"
def main() -> None:
"""Build the closed linkage and capture the durable `.scadpkg`."""
start = time.perf_counter()
OUT_DIR.mkdir(parents=True, exist_ok=True)
result = build_four_bar_linkage()
build_s = time.perf_counter() - start
package_path = OUT_DIR / "four_bar_linkage.scadpkg"
capture_start = time.perf_counter()
scad.capture(result, package_path, include_scene=False)
capture_s = time.perf_counter() - capture_start
print(f"[stage] build: {build_s:.1f}s")
print(f"[stage] capture: {capture_s:.1f}s bytes={package_path.stat().st_size}")
print(f"product_package={package_path}")
if __name__ == "__main__":
main()