Files
make-cad/examples/flange_plate/render_views.py
T
NiJingzhe 49f142a434 examples: migrate every model to notebook projects
Each example is now a project directory of notebooks:
- one part notebook per part; part families (four-bar links, planetary and
  BLDC gears, l-link adapter presets) are one notebook used under several
  ids with scad.use(path, id=..., **overrides)
- assembly and sub-assembly notebooks compose children with scad.use
- shared parameters and helpers stay in plain modules (dimensions, common,
  materials, bearings, FEM steps)
- export and acceptance scripts load products with run_notebook and
  capture one .scadpkg per product, then translate from it

main.py side-effect entry points become export.py; intermediate
hypothesis/probe/diag/archive verify scripts are deleted, and only the
final acceptance checks are kept. l_link_motor_mount and
pcg_attractor_canopy join the index. histcad_demo stays translator output
and demo_kit is unchanged.

examples/SDK_DEFECTS.md records the SDK defects found along the way.
test_example_model_contract now checks that every example model is a
notebook with a unique id; the ap242 and phase-A scene tests load the
notebooks.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-10-02 17:16:51 +08:00

31 lines
1.0 KiB
Python

"""Render the 4-view demo set for flange_plate (8-hole, PCD 84.5).
Views (BUILD_PLAN S3 visual contract):
render_iso.png (30, 45) isometric
render_front.png (0, 0) front (+X toward viewer)
render_top.png (90, 0) top down +Z
render_detail.png (25, 20) zoom 9 — bolt hole + boss root fillet close-up
"""
from pathlib import Path
import simplecadapi as scad
from simplecadapi.runtime import run_notebook
HERE = Path(__file__).resolve().parent
OUT = HERE / "out"
OUT.mkdir(parents=True, exist_ok=True)
body = run_notebook(HERE / "flange_plate.py").product.body
views = {
"render_iso.png": dict(view=(30.0, 45.0), zoom=4.0),
"render_front.png": dict(view=(0.0, 0.0), zoom=4.0),
"render_top.png": dict(view=(90.0, 0.0), zoom=4.0),
"render_detail.png": dict(view=(25.0, 20.0), zoom=9.0),
}
for name, kw in views.items():
path = scad.render_screenshot_rpath(
shapes=body, output_path=str(OUT / name),
image_size=(1400, 900), show_legend=False, show_callouts=False, **kw)
print(f"rendered {path}")