Files
parametric_box/parametric_box.scad
2019-02-27 14:18:05 -08:00

84 lines
1.9 KiB
OpenSCAD

// parametric storage box
// Scott Alfter
// 27 Feb 19
// CC-BY
// https://creativecommons.org/licenses/by/4.0/legalcode.txt
width=50;
height=50;
roundness=10;
label="";
label_size=5;
label_depth=0.25;
// choose one to render (both pieces needed for complete set)
// body();
lid();
// nothing to modify below here in regular use
$fn=90;
module body()
{
difference()
{
intersection()
{
minkowski()
{
intersection()
{
body_profile();
rotate([0,0,90])
body_profile();
}
sphere(d=roundness);
}
translate([0,0,height/2])
cube([width, width, height-roundness/2], center=true);
}
translate([0,-width/2+label_depth, height/2])
rotate([90,0,0])
linear_extrude(label_depth, convexity=10)
text(label, size=label_size, halign="center", valign="center");
}
}
module body_profile()
{
translate([0, width/2, height/2])
rotate([90,0,0])
linear_extrude(width, convexity=10)
polygon([[-width/2+roundness/2, -height/2+roundness/2],
[-width/2+roundness/2, height/2-12-roundness/2],
[-width/2+1.5+roundness/2, height/2-10-roundness/2],
[-width/2+1.5+roundness/2, height/2+roundness-roundness/2],
[width/2-1.5-roundness/2, height/2+roundness-roundness/2],
[width/2-1.5-roundness/2, height/2-10-roundness/2],
[width/2-roundness/2, height/2-12-roundness/2],
[width/2-roundness/2, -height/2+roundness/2]]);
}
module lid()
{
difference()
{
translate([0,0,roundness/2+10-roundness/2])
minkowski()
{
cube([width-roundness, width-roundness, 10], center=true);
sphere(d=roundness);
}
translate([0,0,15+roundness/2])
cube([width, width, 10], center=true);
}
}