mirror of
https://github.com/imjasonh/scad-to-png
synced 2026-07-07 01:22:23 +00:00
- 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>
24 lines
No EOL
548 B
OpenSCAD
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]);
|
|
} |