175 lines
5.1 KiB
OpenSCAD
175 lines
5.1 KiB
OpenSCAD
include <round_anything/polyround.scad>;
|
|
//include <catchnhole/catchnhole.scad>;
|
|
include <BOLTS/BOLTS.scad>;
|
|
//import( "motu.m2.desk.stl");
|
|
$fn=100;
|
|
|
|
dim = [190.5, 44, 108];
|
|
border_radius = 9;
|
|
gap = 0.6;
|
|
thickness = 4;
|
|
thinnness = 4;//0.8;
|
|
top_thickness = 5;
|
|
bottom_opening_width = 153;
|
|
//top_opening_width = 130;
|
|
limiter = 3;
|
|
limiter_thickness = 1.2;
|
|
screw_diameter = 4;
|
|
screwhead_diameter = 6;
|
|
|
|
//cube([220, 27.5*2],center=true);
|
|
//cube([190.5,45, 108], center=true);
|
|
|
|
module screwhole( d, l, cut=0, cutlen=undef, headlen=0) {
|
|
cutlen = is_undef(cutlen) ? (cut-d)/2 : cutlen;
|
|
cylinder( d=d, h=l, center=true);
|
|
c = (cut-d-headlen)/2;
|
|
translate( [0, 0, (l - cutlen - headlen)/2])
|
|
cylinder( d1=d, d2=cut, h=cutlen, center=true);
|
|
translate( [0, 0, (l - headlen)/2])
|
|
cylinder( d=cut, h=headlen, center=true);
|
|
}
|
|
|
|
module rounded_square( dim, radius) {
|
|
br = radius;
|
|
d = [dim.x - 2*br, dim.y - 2*br];
|
|
offset( br)
|
|
square( [d.x, d.y], center=true);
|
|
}
|
|
|
|
module rounded_frame( outer, radius, thickness) {
|
|
difference() {
|
|
rounded_square( outer, radius);
|
|
rounded_square( [outer.x - 2*thickness, outer.y - 2*thickness], radius - thickness);
|
|
}
|
|
}
|
|
|
|
*color("blue")
|
|
linear_extrude( dim.z, center=true)
|
|
rounded_square( dim, border_radius);
|
|
|
|
inner = [dim.x + 2*gap, dim.y + 2*gap, dim.z];
|
|
outer = [inner.x + 2*thickness, inner.y + 2*thickness, inner.z + limiter_thickness];
|
|
|
|
difference() {
|
|
// middle closing
|
|
translate( [0, 0, -limiter_thickness/2]) {
|
|
linear_extrude( outer.z - 4*thickness - 2*screw_diameter, center=true) {
|
|
offset( thickness/2 - 0.1)
|
|
offset( -thickness/2 + 0.1)
|
|
difference() {
|
|
rounded_frame( [inner.x + 2*thinnness, inner.y + 2*thinnness],
|
|
border_radius + gap + thinnness, thinnness);
|
|
translate( [0,-2*thickness])
|
|
square( [bottom_opening_width, inner.y + 2*thickness], center=true);
|
|
square( [bottom_opening_width - screw_diameter - 3*thickness/*inner.x-2*border_radius-thickness*/, inner.y + 2*thickness], center=true);
|
|
//square( [outer.x+2*thickness, inner.y-2*border_radius-thickness], center=true);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Top Opening
|
|
w = bottom_opening_width/2 - screw_diameter/2 - 1.5*thickness;
|
|
u = inner.x/2 - border_radius;
|
|
h = inner.z/2 - 2*thickness - screw_diameter;
|
|
g = h - u + w;
|
|
d = inner.y/2 - border_radius/2;
|
|
t = thickness;
|
|
rotate( [90, 0, 0])
|
|
linear_extrude( outer.y+0.1, center=true)
|
|
polygon( [
|
|
[ w, h],
|
|
[-w, h],
|
|
[-u, g],
|
|
[-u, -g],
|
|
[-w, -h],
|
|
[ w, -h],
|
|
[ u, -g],
|
|
[ u, g]
|
|
]);
|
|
translate( [0, -outer.y/2, 0])
|
|
rotate( [90, 0, 0])
|
|
linear_extrude( outer.y + 0.1, center=true)
|
|
polygon( [
|
|
[ w, h + 2*t],
|
|
[-w, h + 2*t],
|
|
[-u, g + 2*t],
|
|
[-u, -g - 2*t],
|
|
[-w, -h - 2*t],
|
|
[ w, -h - 2*t],
|
|
[ u, -g - 2*t],
|
|
[ u, g + 2*t]
|
|
]);
|
|
rotate( [0, 90, 0])
|
|
linear_extrude( outer.x + 0.1, center=true)
|
|
polygon( [
|
|
[ g+t, d],
|
|
[ h+t, 0],
|
|
[ g+t, -d],
|
|
[-g-t, -d],
|
|
[-h-t, 0],
|
|
[-g-t, d]
|
|
]);
|
|
}
|
|
|
|
{
|
|
t = 2*thickness + screw_diameter;
|
|
// Back closing with screw holes
|
|
translate( [0, 0, outer.z/2 - t/2 - limiter_thickness/2])
|
|
difference() {
|
|
linear_extrude( t, center=true) {
|
|
offset( thickness/2 - 0.1)
|
|
offset( -thickness/2 + 0.1)
|
|
difference() {
|
|
rounded_frame( [outer.x, outer.y], border_radius + gap + thickness, thickness);
|
|
translate( [0, -2*thickness])
|
|
square( [bottom_opening_width, inner.y], center=true);
|
|
square( [bottom_opening_width - screw_diameter - 4*thickness, inner.y + 2*thickness], center=true);
|
|
}
|
|
}
|
|
for( i = [0, 1])
|
|
mirror( [i, 0, 0])
|
|
translate( [
|
|
bottom_opening_width/2 - screw_diameter/2,
|
|
outer.y/2 - thickness/2,
|
|
-thickness/2 + screw_diameter/2
|
|
])
|
|
rotate( [90, 0, 0])
|
|
screwhole( screw_diameter, thickness + 0.01, screw_diameter + 2, cutlen=1, headlen=1);
|
|
}
|
|
}
|
|
|
|
// limiter
|
|
translate( [0, 0, -outer.z/2]) {
|
|
linear_extrude( limiter_thickness, center=true) {
|
|
offset( thickness/2 - 0.1)
|
|
offset( -thickness/2 + 0.1)
|
|
difference()
|
|
rounded_frame( [outer.x, outer.y], border_radius+gap+thickness, gap+thickness+limiter);
|
|
}
|
|
t = 2*thickness + screw_diameter;
|
|
translate( [0, 0, t/2])
|
|
difference() {
|
|
union() {
|
|
linear_extrude( t, center=true) {
|
|
offset( thickness/2 - 0.1) offset( -thickness/2 + 0.1) difference() {
|
|
rounded_frame( [outer.x, outer.y], border_radius + gap + thickness, thickness);
|
|
translate( [0, -2*thickness])
|
|
square( [bottom_opening_width, inner.y], center=true);
|
|
square( [bottom_opening_width - screw_diameter - 3*thickness, inner.y + 2*thickness], center=true);
|
|
}
|
|
}
|
|
translate( [0, 0, 1.5*thickness-t/2])
|
|
linear_extrude( 3*thickness, center=true) {
|
|
offset( thickness/2 - 0.1) offset( -thickness/2 + 0.1)
|
|
rounded_frame( [outer.x, outer.y], border_radius + gap + thickness, thickness);
|
|
}
|
|
}
|
|
for(i=[0,1])
|
|
mirror([i,0,0])
|
|
translate( [bottom_opening_width/2 - screw_diameter/2, outer.y/2-thickness/2, thickness/2 - screw_diameter/2 + thickness/2])
|
|
rotate( [90, 0, 0])
|
|
screwhole( screw_diameter, thickness + 0.01, screw_diameter + 2, cutlen=1, headlen=1);
|
|
|
|
}
|
|
} |