49f142a434
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>
47 lines
1.1 KiB
Python
47 lines
1.1 KiB
Python
# /// script
|
|
# requires-python = ">=3.10"
|
|
# dependencies = ["simplecadapi"]
|
|
#
|
|
# [tool.simplecadapi]
|
|
# id = "gear_train_gear"
|
|
# ///
|
|
"""A gear blank with one axis connector at its bottom center.
|
|
|
|
The gear train uses this one definition for both of its gears.
|
|
"""
|
|
|
|
import marimo
|
|
|
|
app = marimo.App()
|
|
|
|
with app.setup:
|
|
import simplecadapi as scad
|
|
|
|
|
|
@app.cell
|
|
def _():
|
|
# ---- feature: gear-blank (build) ----
|
|
gear_blank = scad.make_cylinder_rsolid(radius=4.0, height=3.0)
|
|
return (gear_blank,)
|
|
|
|
|
|
@app.cell
|
|
def _(gear_blank):
|
|
_body = scad.apply_tag(shape=gear_blank, tag="role.gear_train_gear")
|
|
gear_train_gear = scad.add_connector_rpart(
|
|
part=scad.make_part_rpart(part_id="gear_train_gear", body=_body),
|
|
connector=scad.make_placement_connector_rconnector(
|
|
connector_id="axis",
|
|
placement=scad.make_placement_rplacement(origin=(0.0, 0.0, 0.0)),
|
|
),
|
|
)
|
|
print(
|
|
f"gear: volume={gear_train_gear.body.get_volume():.3f} "
|
|
f"faces={len(scad.ql.faces().resolve(gear_train_gear.body))}"
|
|
)
|
|
return (gear_train_gear,)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app.run()
|