93 lines
3.0 KiB
OpenSCAD
93 lines
3.0 KiB
OpenSCAD
|
|
// 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); |