Add boxes

This commit is contained in:
Laur IVAN 2022-08-21 19:08:26 +02:00
parent e7d0196e50
commit a01e1853a7
5 changed files with 363 additions and 0 deletions

82
base.scad Normal file
View File

@ -0,0 +1,82 @@
include <./rosetta.scad>
base = 160; // mm
top = 90; //mm
height = 40;
thickness = 9; // mm
thick_height=7; // mm
delta = 0.01;
// M4
screw_width = 5; //mm
piulitza = 7; // mm
piulitza_h = 4; // mm
// dent depth
dent_depth = 3.5;
base_2 = base/2;
top_2 = top/2 - 1;
top_3 = top_2 - 5;
top_4 = top_2/2;
screw_distance = 33;
inital_screw_angle = -30;
thin_base = (base-thickness);
thin_base_2 = thin_base/2;
//slit
slit_b1 = (thickness*2/3)/2;
slit_b2 = slit_b1/2;
slit_h = slit_b2;
module ovaloid(radius, width, height) {
union(){
translate([-width/2+radius,0,0]) cylinder(r=radius, h=height);
translate([width/2 - radius, 0,0]) cylinder(r=radius, h=height);
translate([0,0,height/2]) cube([width-radius*2, radius*2, height],center=true);
}
}
module hole(radius, width, height, thickness) {
difference() {
ovaloid(radius,width,height);
translate([0,0,-delta])
ovaloid(radius-thickness,width-thickness*3.14/2,height+2*delta);
}
}
union() {
translate([0,0,-2])
hole(screw_width+3,screw_width*5+6,1.5,1.5);
translate([0,-base/3,-2])
rotate([0,0,90])
hole(screw_width+3,screw_width*5+6,1.5,1.5);
difference() {
cube([base,base,thickness], center= true);
translate([0,0,dent_depth-1])
cube([thin_base,thin_base,thickness], center= true);
// screws
translate([0,0,-thickness-delta])
ovaloid(screw_width,screw_width*5,10);
translate([0,-base/3,0])
rotate([0,0,90])
translate([0,0,-thickness-delta])
ovaloid(screw_width,screw_width*5,10);
}
// The two slits to slide the base into
//
translate([-base_2 + slit_b2*3/2,base_2-slit_h,thickness-4-delta])
rotate([90, 180, 0])
trapeze(slit_b1,slit_b2,slit_h,base-slit_h);
translate([base_2 - slit_b2*3/2,base_2-slit_h,thickness-4-delta])
rotate([90, 180, 0])
trapeze(slit_b1,slit_b2,slit_h,base-slit_h);
}

107
reolink-box.scad Normal file
View File

@ -0,0 +1,107 @@
include <BOSL2/std.scad>
include <./rosetta.scad>
base = 160; // mm
top = 90; //mm
height = 40;
thickness = 9; // mm
thick_height=7; // mm
delta = 0.01;
// M4
screw_width = 5; //mm
piulitza = 7; // mm
piulitza_h = 4; // mm
// dent depth
dent_depth = 3.5;
base_2 = base/2;
top_2 = top/2 - 1;
top_3 = top_2 - 5;
top_4 = top_2/2;
screw_distance = 33;
inital_screw_angle = -30;
thin_base = (base-thickness);
thin_base_2 = thin_base/2;
//slit
slit_b1 = (thickness*2/3)/2;
slit_b2 = slit_b1/2;
slit_h = slit_b2;
top_3 = top_2 - 5;
module m3base(x,y,z) {
translate([x , y, z]) cylinder(h=thick_height+delta*3, d=screw_width);
translate([x , y, z]) cylinder(h=piulitza_h, d=piulitza);
}
/* TODO - the screw notch for the bottom
module m3notch(x,y,z) {
difference() {
translate(x,y,z)
*/
$fn = 180; //production
$fn = 32; //development
difference () {
union() {
//translate([0,0,-slit_h])
//color("green") translate([0,0,height-piulitza_h*2]) cap(true);
difference() {
translate([-base_2,-base_2,0]) cube([base,base,slit_h*2]);
translate([-thin_base_2 ,-thin_base_2, -delta]) cube([thin_base,thin_base,slit_h*2+1]);
}
difference() {
hull(){
translate([-base_2,-base_2,0]) cube([base,base,slit_h*2]);
translate([-base_2,-base_2, height]) cube([base,base,slit_h*2]);
//cylinder(h=delta, r=top_3, center=true);
}
hull() {
translate([-thin_base_2,-thin_base_2,-delta])
cube([thin_base,thin_base,slit_h*2]);
translate([-thin_base_2,-thin_base_2, height - thickness + delta])
cube([thin_base,thin_base,slit_h*2]);
// cylinder(delta, top_3-thickness, center=true);
}
translate([0,0, height - delta])
cylinder(h=15, r=top_3, center=true);
}
difference() {
translate([0 ,0, height-4]) cylinder(h=thick_height,r=top_3);
translate([0 ,0, height-4-delta]) cylinder(h=thick_height+delta*2,r=top_3-thickness*1.5);
}
}
union() {
// The two slits to slide the base into
//
translate([-base_2 + slit_b2*3/2,base_2-slit_h,+slit_h/2-delta*2])
rotate([90, 180, 0])
trapeze(slit_b1,slit_b2,slit_h,base);
translate([base_2 - slit_b2*3/2,base_2-slit_h,+slit_h/2-delta*2])
rotate([90, 180, 0])
trapeze(slit_b1,slit_b2,slit_h,base);
// The rosetta
translate([0,0, height + delta]) rosetta_flat(top_3, piulitza_h, dent_depth);
translate([0,0, height - piulitza_h+delta]) rosetta_flat(top_3, piulitza_h+delta, dent_depth);
translate([0,0, height - piulitza_h+delta]) rotate (53,0,0) rosetta_flat(top_3, piulitza_h+delta, dent_depth);
translate([0,0, height - piulitza_h*2+delta]) rosetta_flat(top_3, piulitza_h+delta, dent_depth);
translate([0,0, height - piulitza_h*2+delta]) rotate (53,0,0) rosetta_flat(top_3, piulitza_h+delta, dent_depth);
}
}

View File

@ -0,0 +1,30 @@
include <BOSL2/std.scad>
include <./rosetta.scad>
base = 160; // mm
top = 90; //mm
height = 50;
thickness = 9; // mm
thick_height=7; // mm
delta = 0.01;
// M4
screw_width = 5; //mm
piulitza = 7; // mm
piulitza_h = 4; // mm
// dent depth
dent_depth = 3.5;
base_2 = base/2;
top_2 = top/2 - 1;
top_3 = top_2 - 5;
top_4 = top_2/2;
screw_distance = 33;
inital_screw_angle = -30;
$fn = 180; //production
$fn = 24; //development
cap(true);

51
reolink-cap.scad Normal file
View File

@ -0,0 +1,51 @@
include <BOSL2/std.scad>
include <./rosetta.scad>
base = 160; // mm
top = 90; //mm
height = 50;
thickness = 9; // mm
thick_height=7; // mm
delta = 0.01;
// M4
screw_width = 5; //mm
piulitza = 7; // mm
piulitza_h = 4; // mm
base_2 = base/2;
top_2 = top/2 - 1;
top_3 = top_2 - 5;
top_4 = top_2/2;
screw_distance = 33;
inital_screw_angle = -30;
$fn = 180;
difference() {
union() {
rosetta(top_3, piulitza_h, screw_width);
color("lightgreen") translate([0,0,piulitza_h-delta]) cylinder(h=piulitza_h, r=top_3-piulitza_h-1);
color("lightblue") translate([0,0,piulitza_h*2-delta]) cylinder(h=piulitza_h,r1=top_2-3, r2=top_3);
//translate([0,0,6])
//cylinder(h=2,r=top_2,center=true, $fn=segments);
}
union() {
color("green") translate([0,0,-5]) {
// screw holes
rotate([0,0, inital_screw_angle]) translate([0,screw_distance-screw_width/2,0]) cylinder(20,r=screw_width/2);
rotate([0,0, inital_screw_angle + 120]) translate([0,screw_distance-screw_width/2,0]) cylinder(20,r=screw_width/2);
rotate([0,0,inital_screw_angle-120]) translate([0,screw_distance-screw_width/2,0]) cylinder(20,r=screw_width/2);
// cable pass
cylinder(h=20, r=12.5);
}
// Thinner disk
translate([0,0,-2]) cylinder(h=piulitza_h*2, r=top_3*2/3);
}
}

93
rosetta.scad Normal file
View File

@ -0,0 +1,93 @@
// rotate as per a, v, but around point pt
module rotate_about_pt(z, y, pt) {
translate(pt)
rotate([0, y, z])
translate(-pt)
children();
}
module dent(radius, height, depth, delta=0.001) {
difference() {
color("blue")
translate([-radius, 0, 0])
cylinder(h=height, r=radius+depth, $fn=3);
union() {
color("red")
translate([0,0,-delta])
cylinder(h=height+2*delta, r=radius-depth);
}
}
}
module tilted_dent(radius, height, depth, delta=0.001) {
translate([0,0,-delta]) dent(radius, height, depth, delta);
rotate([5,0,60]) translate([0,0,height*(1-sin(5))]) dent(radius, height, depth, delta);
}
module rosetta(radius,height,depth,delta=0.001) {
difference() {
cylinder(h=height, r=radius);
union() {
tilted_dent(radius,height+2*delta,depth);
rotate([0,0,120]) tilted_dent(radius,height+2*delta,depth);
rotate([0,0,-120]) tilted_dent(radius,height+2*delta,depth);
}
}
}
module rosetta_flat(radius,height,depth,delta=0.001) {
difference() {
cylinder(h=height, r=radius);
translate([0,0,-delta]) union() {
dent(radius,height+2*delta,depth);
rotate([0,0,120]) dent(radius,height+2*delta,depth);
rotate([0,0,-120]) dent(radius,height+2*delta,depth);
}
}
}
module trapeze(b1, b2, h, w) {
color("red")
linear_extrude(height=w)
polygon(points= [[-b1/2, -h/2],
[-b2/2, h/2],
[b2/2, h/2],
[b1/2, -h/2]
]);
}
module cap(flat=true) {
difference() {
union() {
// Generate a flat or screw rosetta if needed
if (flat)
rosetta_flat(top_3, piulitza_h, dent_depth);
else
rosetta(top_3, piulitza_h, dent_depth);
color("lightgreen") translate([0,0,piulitza_h-delta]) cylinder(h=piulitza_h, r=top_3-dent_depth);
color("lightblue") translate([0,0,piulitza_h*2-delta]) cylinder(h=piulitza_h,r1=top_2-3, r2=top_3);
}
union() {
color("green") translate([0,0,-5]) {
// screw holes
rotate([0,0, inital_screw_angle]) translate([0,screw_distance-screw_width/2,0]) cylinder(20,r=screw_width/2);
rotate([0,0, inital_screw_angle + 120]) translate([0,screw_distance-screw_width/2,0]) cylinder(20,r=screw_width/2);
rotate([0,0,inital_screw_angle-120]) translate([0,screw_distance-screw_width/2,0]) cylinder(20,r=screw_width/2);
// cable pass
cylinder(h=20, r=12.5);
}
// Thinner disk
translate([0,0,-2]) cylinder(h=piulitza_h*2, r=top_3*2/3);
}
}
}
//rosetta_flat(10, 3, 3);