lithophane_lantern/3dparts/lithophane.scad

250 lines
8 KiB
OpenSCAD

litho_height = 100;
litho_width = 70;
litho_support = 5;
middle_width = 15;
base_height = 35;
wall_width = 4;
panel_thick = 2;
tolerance = 1;
base_width = litho_width + 2*litho_support + 6*wall_width;
top_height = 20;
top_r1 = base_width;
top_r2 = 2*litho_support;
top_r3 = 2*litho_support;
module base() {
module baseform(width, height, cylinder_r, cylinder_offset) {
union() {
cube([width, width, height]);
translate([-cylinder_offset, -cylinder_offset, 0])
cylinder(r1=cylinder_r, r2=litho_support, h=0.75*height);
translate([width+cylinder_offset, -cylinder_offset, 0])
cylinder(r1=cylinder_r, r2=litho_support, h=0.75*height);
translate([-cylinder_offset, width+cylinder_offset, 0])
cylinder(r1=cylinder_r, r2=litho_support, h=0.75*height);
translate([width+cylinder_offset, width+cylinder_offset, 0])
cylinder(r1=cylinder_r, r2=litho_support, h=0.75*height);
}
}
module angle() {
difference() {
cube([
litho_support+3*wall_width,
litho_support+3*wall_width,
litho_height+base_height+wall_width+litho_support]);
translate([wall_width, 3*wall_width, base_height-litho_support])
cube([
wall_width,
litho_support+wall_width,
litho_height+2*litho_support+2*wall_width]);
translate([3*wall_width, wall_width, base_height-litho_support])
cube([
litho_support+2*wall_width,
wall_width,
litho_height+2*litho_support+2*wall_width]);
};
}
union() {
difference() {
baseform(
base_width,
base_height,
litho_support+2*wall_width, -litho_support);
translate([
3*wall_width,
3*wall_width,
wall_width]
)
cube([
base_width-6*wall_width,
base_width-6*wall_width,
base_height]);
translate([
wall_width,
wall_width,
base_height-litho_support-wall_width]
)
cube([
base_width-2*wall_width,
base_width-2*wall_width,
base_height]);
translate([base_width/2-20, 3*wall_width, base_height/2-3]) rotate([90, 0, 0])
cylinder(r=10.25, h=4*wall_width, $fn=100); //power button
translate([base_width/2, 3*wall_width, base_height/2-9]) rotate([90, 0, 0])
cylinder(r=4, h=4*wall_width, $fn=100); //color button
translate([base_width/2, 3*wall_width, base_height/2+3]) rotate([90, 0, 0])
cylinder(r=4, h=4*wall_width, $fn=100); //mode button
translate([base_width/2+20, 3*wall_width, base_height/2]) rotate([90, 0, 0])
cylinder(r=4.25, h=4*wall_width, $fn=100); //power jack
translate([base_width/2-35, panel_thick, wall_width])
cube([42, 4*wall_width, base_height-litho_support-wall_width]);
translate([base_width/2+15, panel_thick, wall_width])
cube([12, 4*wall_width, base_height-litho_support-wall_width]);
}
// Four angles
angle();
translate([base_width, 0, 0]) rotate([0, 0, 90]) angle();
translate([base_width, base_width, 0]) rotate([0, 0, 180]) angle();
translate([0, base_width, 0]) rotate([0, 0, -90]) angle();
translate([0, 0, base_height+litho_height])
difference() {
cube([base_width, base_width, litho_support+wall_width]);
translate([wall_width, wall_width, -wall_width])
cube([
base_width-2*wall_width,
base_width-2*wall_width,
litho_support+3*wall_width]);
}
translate([
base_width/2-middle_width/2,
base_width/2-middle_width/2,
wall_width
]) cube([middle_width, middle_width, base_height+litho_height]);
// card supports
translate([18, base_width-45, wall_width])
difference() {
cube([35+2*panel_thick, 26+2*panel_thick, 3*wall_width]);
translate([panel_thick, panel_thick, wall_width])
cube([35, 26, 4*wall_width]);
translate([35-panel_thick, panel_thick+5, wall_width])
cube([4*panel_thick, 16, 4*wall_width]);
};
translate([18, base_width-60, wall_width])
difference() {
cube([16+2*panel_thick, 13+2*panel_thick, 3*wall_width]);
translate([panel_thick, panel_thick, wall_width])
cube([16, 13, 4*wall_width]);
};
}
}
module inside_plate(height) {
difference() {
cube([
base_width-2*wall_width-2*tolerance,
base_width-2*wall_width-2*tolerance,
height]);
translate([-wall_width, -wall_width, -height]) cube([
litho_support+4*wall_width,
litho_support+4*wall_width,
3*height
]);
translate([
base_width-litho_support-5*wall_width,
-wall_width,
-height])
cube([
litho_support+4*wall_width,
litho_support+4*wall_width,
3*height
]);
translate([
-wall_width,
base_width-litho_support-5*wall_width,
-height
]) cube([
litho_support+4*wall_width,
litho_support+4*wall_width,
3*height
]);
translate([
base_width-litho_support-5*wall_width,
base_width-litho_support-5*wall_width,
-height
]) cube([
litho_support+4*wall_width,
litho_support+4*wall_width,
3*height
]);
}
}
module separator() {
translate([wall_width+tolerance, wall_width+tolerance, base_height-litho_support-wall_width])
difference() {
inside_plate(wall_width);
translate([
base_width/2-wall_width,
base_width/2-wall_width,
-wall_width
]) cylinder(r=middle_width, h=3*wall_width);
};
}
module top() {
translate([0, 0, base_height+litho_height+2*wall_width])
union() {
translate([
wall_width+tolerance,
wall_width+tolerance, 0])
inside_plate(2*(litho_support-wall_width));
translate([0, 0, 2*(litho_support-wall_width)])
difference() {
translate([
base_width/2,
base_width/2,
top_height/2
]) cylinder(
h=top_height,
r1=top_r1,
r2=top_r2,
center=true,
$fn=100);
translate([
base_width/2,
-1.7*top_r1,
5.25*top_r1
]) sphere(r=5.5*top_r1, $fn=100);
translate([
-1.7*top_r1,
base_width/2,
5.25*top_r1
]) sphere(r=5.5*top_r1, $fn=100);
translate([
base_width/2,
base_width+1.7*top_r1,
5.25*top_r1
]) sphere(r=5.5*top_r1, $fn=100);
translate([
base_width+1.7*top_r1,
base_width/2,
5.25*top_r1
]) sphere(r=5.5*top_r1, $fn=100);
};
translate([
base_width/2,
base_width/2,
top_r3/2+top_height
]) sphere(r=top_r3);
};
}
base();
//separator();
//top();