1
0
Fork 0
mirror of https://github.com/imjasonh/scad-to-png synced 2026-07-07 01:22:23 +00:00
scad-to-png/examples/parametric-box.scad
Jason Hall 3a28919b97
Add support for parametric OpenSCAD models
- Add -D/--define option to pass parameters to OpenSCAD
- Parameters are passed through to OpenSCAD WASM using the same syntax
  as native OpenSCAD CLI (e.g., -D width=30 -D has_lid=true)
- Update openscad-wrapper.mjs to handle additional command-line arguments
- Add parametric-box.scad example demonstrating parameter usage
- Update documentation with parameter examples
- Include rendered outputs for parametric example with default values

This enables users to explore parametric models without modifying the
source files, which is particularly useful for CI/CD pipelines and
AI agents testing different variations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 18:17:22 -04:00

24 lines
No EOL
548 B
OpenSCAD

// Parametric box with customizable dimensions
// Default values
width = 20;
height = 10;
depth = 15;
wall_thickness = 2;
has_lid = false;
difference() {
// Outer box
cube([width, depth, height]);
// Inner cavity
translate([wall_thickness, wall_thickness, wall_thickness])
cube([width - 2*wall_thickness,
depth - 2*wall_thickness,
height - (has_lid ? wall_thickness : 0)]);
}
// Optional lid
if (has_lid) {
translate([0, depth + 5, 0])
cube([width, depth, wall_thickness]);
}