Files
productivity-module/module.scad
2026-04-07 20:02:30 +02:00

287 lines
8.9 KiB
OpenSCAD

include <BOSL2/std.scad>
box_width=30;
box_height=13;
box_border_width=0.8;
rounding_edge=1;
screw_offset=2.7;
box_hull=1.2;
led_diameter=8;
led_length=11;
led_margin=1.5;
led_box_height=2.5;
led_ring=0.5;
wire_diam=1.0;
wire_cache=0.6;
wire_offset=10;
wire_height=3;
m14_head=2.5;
m14_hole=1.5;
m2_head_diam=3.8;
m2_head_height=1.4;
m2_hole=2.1;
screw_throught_plastic_diam=2.7;
screw_throught_plastic_depth=3.2;
pcb_pad=5;
pcb_width=0.8;
pcb_top_margin=2;
pcb_gap=2.2;
fn=64;
module 8mm_led(){
union(){
translate([0,0,led_length-led_diameter/2])
sphere(r=led_diameter/2,$fn=fn);
cylinder(h=led_length-led_diameter/2,r=led_diameter/2,$fn=fn);
};
}
module pcb_top(){
difference(){
union(){
color("green")
translate([0,0,pcb_width/2])
cuboid([box_width-2*box_hull-0.1,box_width-2*box_hull-0.1,pcb_width], rounding=rounding_edge, edges = "Z",$fn=fn);
}
union(){
translate([box_width/2-2*pcb_pad,-box_width/2+pcb_pad-1,-0.01])
cylinder(h=pcb_width+0.02,r=m2_hole/2,$fn=fn);
translate([-box_width/2+2*pcb_pad,box_width/2-pcb_pad+1,-0.01])
cylinder(h=pcb_width+0.02,r=m2_hole/2,$fn=fn);
}
}
rotate([0,0,45]){
translate([-led_diameter-2*led_ring,0,pcb_width])
8mm_led();
translate([0,0,pcb_width])
8mm_led();
translate([led_diameter+2*led_ring,0,pcb_width])
8mm_led();
}
}
module pcb_bottom(){
difference(){
union(){
color("green")
translate([0,0,-pcb_width/2])
cuboid([box_width-2*box_hull-0.1,box_width-2*box_hull-0.1,pcb_width], rounding=rounding_edge, edges = "Z",$fn=fn);
color("gray")
translate([0,-1.75+box_width/2-box_hull,-pcb_width-1.65])
rotate([90,90,0])
cuboid([3.3,9,6.5], rounding=0.8, edges = "Z",$fn=fn);
}
union(){
translate([-box_width/2+box_hull+pcb_pad/2,box_width/2-box_hull-pcb_pad/2,-pcb_width-0.01])
cylinder(h=pcb_width+0.02,r=m2_hole/2,$fn=fn);
translate([box_width/2-box_hull-pcb_pad/2,-box_width/2+box_hull+pcb_pad/2,-pcb_width-0.01])
cylinder(h=pcb_width+0.02,r=m2_hole/2,$fn=fn);
}
}
}
module wire_cache(wire_count){
difference(){
cuboid([wire_count*wire_diam+2*wire_cache,wire_diam+2*wire_cache,wire_cache*2], rounding=wire_cache+wire_diam/2, edges = "Z",$fn=fn);
cuboid([wire_count*wire_diam,wire_diam,wire_cache*2+0.1], rounding=wire_diam/2, edges = "Z",$fn=fn);
};
}
module indicator(){
translate([0,0,led_box_height/2-rounding_edge/2])
cuboid([3*led_diameter+2*led_margin+6*led_ring,led_diameter+2*led_margin+2*led_ring,led_box_height+rounding_edge], rounding=rounding_edge,$fn=fn);
rotate([90,0,0])
translate([wire_offset,wire_diam/2+wire_cache,led_diameter/2+led_margin+led_ring])
wire_cache(4);
translate([-led_diameter-2*led_ring,0,led_box_height])
cylinder(h=led_ring,r=led_diameter/2+led_ring,$fn=fn);
translate([0,0,led_box_height])
cylinder(h=led_ring,r=led_diameter/2+led_ring,$fn=fn);
translate([led_diameter+2*led_ring,0,led_box_height])
cylinder(h=led_ring,r=led_diameter/2+led_ring,$fn=fn);
}
module indicator_hole(){
translate([0,0,led_box_height/2-rounding_edge/2-box_hull])
cuboid([3*led_diameter+2*led_margin+6*led_ring-2*box_hull,led_diameter+2*led_margin+2*led_ring-2*box_hull,led_box_height+rounding_edge], rounding=rounding_edge, edges = "Z",$fn=fn);
rotate([90,0,0])
translate([wire_offset,wire_diam/2+wire_cache,led_diameter/2+led_margin+led_ring])
cuboid([4*wire_diam,wire_diam,5], rounding=wire_diam/2,$fn=fn);
translate([-led_diameter-2*led_ring,0,0])
cylinder(h=led_box_height+led_ring+0.001,r=led_diameter/2,$fn=fn);
cylinder(h=led_box_height+led_ring+0.001,r=led_diameter/2,$fn=fn);
translate([led_diameter+2*led_ring,0,0])
cylinder(h=led_box_height+led_ring+0.001,r=led_diameter/2,$fn=fn);
}
module mounting_pad_top(){
for (r = [ 0 : 180 : 360 ])
rotate([0,0,r])
difference(){
translate([-box_width/2+box_hull+pcb_pad-0.5,box_width/2-box_hull-pcb_pad,pcb_top_margin+pcb_width])
cube([pcb_pad*2,pcb_pad,3]);
}
}
module mounting_pad_bottom(){
for (r = [ 90 : 180 : 360 ])
rotate([0,0,r])
difference(){
translate([-(-box_width/2+box_hull+pcb_pad),box_width/2-box_hull-pcb_pad,-pcb_gap-pcb_top_margin-pcb_width])
cube([pcb_pad,pcb_pad,4]);
}
}
module mounting_hole_top(){
for (r = [ 0 : 180 : 360 ])
rotate([0,0,r])
translate([-box_width/2+2*pcb_pad,box_width/2-pcb_pad+1,pcb_top_margin+pcb_width-0.01])
cylinder(h=screw_throught_plastic_depth,r=screw_throught_plastic_diam/2,$fn=fn);
}
module mounting_hole_bottom(){
for (r = [ 90 : 180 : 360 ])
rotate([0,0,r])
translate([-(-box_width/2+box_hull+pcb_pad/2),box_width/2-box_hull-pcb_pad/2,-pcb_gap+pcb_top_margin-pcb_width-screw_throught_plastic_depth])
cylinder(h=screw_throught_plastic_depth+0.01,r=screw_throught_plastic_diam/2,$fn=fn);
}
module box_eyelet_hole(){
for (r = [ 0 : 90 : 360 ]){
rotate([0,0,r]){
offset_x = box_width/2-(1.5*rounding_edge+m14_head/2+box_border_width);
offset_y = -box_width/2-box_border_width;
translate([offset_x,offset_y,0])
cuboid([m14_head+box_border_width,m14_head+box_border_width,6], rounding=m14_head/2+box_border_width/2, $fn=fn);
translate([-offset_x,offset_y,0])
cuboid([m14_head+box_border_width,m14_head+box_border_width,6], rounding=m14_head/2+box_border_width/2, $fn=fn);
}
}
}
module box_top_hole(){
for (r = [ 0 : 90 : 360 ]){
rotate([0,0,r]){
translate([box_width/2-screw_offset,box_width/2-screw_offset,box_height/2])
cylinder(h=m2_head_height,r=m2_head_diam/2,center=true,$fn=fn);
translate([box_width/2-screw_offset,box_width/2-screw_offset,box_height/2])
cylinder(h=5,r=m2_hole/2,center=true,$fn=fn);
}
}
}
module box_eyelet(){
difference(){
union(){
translate([0,0,-box_border_width])
cylinder(h=box_border_width,r=m14_head/2+box_border_width,$fn=fn);
cylinder(h=box_border_width,r=m14_head/2+box_border_width/2,$fn=fn);
}
translate([0,0,-box_border_width-0.1])
cylinder(h=3*box_border_width-0.1,r=m14_hole/2,$fn=fn);
}
}
module box(){
difference(){
union(){
cuboid([box_width,box_width,box_height], rounding=rounding_edge,$fn=fn);
translate([0,0,-box_border_width/2])
cuboid([box_width+2*box_border_width,box_width+2*box_border_width,box_border_width], rounding=rounding_edge+box_border_width, edges = "Z",$fn=fn);
}
union(){
box_eyelet_hole();
box_top_hole();
cuboid([box_width-2*box_hull,box_width-2*box_hull,box_height-2*box_hull], rounding=rounding_edge, edges = "Z",$fn=fn);
}
}
for (r = [ 0 : 90 : 360 ]){
rotate([0,0,r]){
offset_x=box_width/2-(1.5*rounding_edge+m14_head/2+box_border_width);
offset_y=-box_width/2-box_border_width;
translate([offset_x,offset_y,0])
box_eyelet();
translate([-offset_x,offset_y,0])
box_eyelet();
}
}
}
module productivity_module(){
color("red")
difference(){
union() {
box();
mounting_pad_top();
mounting_pad_bottom();
rotate([90,0,90])
translate([0,wire_height,box_width/2])
wire_cache(4);
rotate([0,0,45])
translate([0,0,box_height/2])
indicator();
}
union(){
mounting_hole_top();
mounting_hole_bottom();
rotate([0,0,45])
translate([0,0,box_height/2])
indicator_hole();
rotate([90,0,90])
translate([0,wire_height,box_width/2])
cuboid([4*wire_diam,wire_diam,5], rounding=wire_diam/2, edges = "Z",$fn=fn);
translate([0,-1.75+box_width/2-box_hull+0.5,-pcb_gap+pcb_top_margin-pcb_width-1.65])
rotate([90,90,0])
cuboid([3.5,9.2,6.5], rounding=0.8, edges = "Z",$fn=fn);
}
}
}
translate([0,0,pcb_top_margin])
pcb_top();
translate([0,0,-pcb_gap+pcb_top_margin])
pcb_bottom();
difference(){
productivity_module();
//translate([0,0,(box_height-0.001)])
// cube([1.5*box_width,1.5*box_width,2*box_height],center=true);
}