Files
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

51 lines
1.3 KiB
Python

# /// script
# requires-python = ">=3.10"
# dependencies = ["simplecadapi"]
#
# [tool.simplecadapi]
# id = "gear_train_base"
# ///
"""Base plate of the gear train: two axis connectors, 20 mm apart."""
import marimo
app = marimo.App()
with app.setup:
import simplecadapi as scad
@app.cell
def _():
# ---- feature: base-block (build) ----
base_block = scad.make_box_rsolid(width=30.0, height=8.0, depth=2.0)
return (base_block,)
@app.cell
def _(base_block):
_body = scad.apply_tag(shape=base_block, tag="role.gear_train_base")
_part = scad.make_part_rpart(part_id="gear_train_base", body=_body)
# The gear axes, on the top face.
for _connector_id, _origin in (
("left_axis", (5.0, 4.0, 2.0)),
("right_axis", (25.0, 4.0, 2.0)),
):
_part = scad.add_connector_rpart(
part=_part,
connector=scad.make_placement_connector_rconnector(
connector_id=_connector_id,
placement=scad.make_placement_rplacement(origin=_origin),
),
)
gear_train_base = _part
print(
f"base: volume={gear_train_base.body.get_volume():.1f} "
f"connectors={','.join(gear_train_base.connector_ids())}"
)
return (gear_train_base,)
if __name__ == "__main__":
app.run()