51 lines
1.6 KiB
Python
51 lines
1.6 KiB
Python
"""SimpleCADAPI specialist-backend smoke test for CAD Router V1."""
|
|
|
|
from pathlib import Path
|
|
|
|
import simplecadapi as scad
|
|
|
|
|
|
N_TEETH = 20
|
|
MODULE = 2.0
|
|
PRESSURE_ANGLE = 20.0
|
|
HELIX_ANGLE = 30.0
|
|
GEAR_HEIGHT = 12.0
|
|
BORE_DIAMETER = 12.0
|
|
|
|
|
|
def generate() -> None:
|
|
output_root = Path(__file__).resolve().parent
|
|
|
|
with scad.GraphSession() as session:
|
|
gear = scad.std.gear.make_herringbone_gear_rsolid(
|
|
n_teeth=N_TEETH,
|
|
module=MODULE,
|
|
pressure_angle=PRESSURE_ANGLE,
|
|
helix_angle=HELIX_ANGLE,
|
|
gear_height=GEAR_HEIGHT,
|
|
addendum_factor=1.0,
|
|
clearance_factor=0.25,
|
|
backlash=0.05,
|
|
)
|
|
bore = scad.make_cylinder_rsolid(
|
|
radius=BORE_DIAMETER / 2.0,
|
|
height=GEAR_HEIGHT + 2.0,
|
|
bottom_face_center=(0.0, 0.0, -1.0),
|
|
axis=(0.0, 0.0, 1.0),
|
|
)
|
|
gear = scad.cut_rsolid(gear, bore, skip_non_intersecting=False)
|
|
gear = scad.apply_tag(shape=gear, tag="role.power_transmission.gear")
|
|
|
|
model_json = scad.export_model_json(session=session, indent=2)
|
|
(output_root / "herringbone_gear_simplecad.json").write_text(model_json, encoding="utf-8")
|
|
scad.export_step(shapes=gear, filename=str(output_root / "herringbone_gear_simplecad.step"))
|
|
scad.export_stl(shapes=gear, filename=str(output_root / "herringbone_gear_simplecad.stl"))
|
|
|
|
print("volume_mm3", round(gear.get_volume(), 3))
|
|
print("tags", scad.list_tags(shape=gear))
|
|
print("graph_nodes", session.graph.node_count)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
generate()
|