144 lines
4.4 KiB
OpenSCAD
144 lines
4.4 KiB
OpenSCAD
|
include <BOSL/constants.scad>
|
||
|
use <BOSL/transforms.scad>
|
||
|
use <BOSL/shapes.scad>
|
||
|
|
||
|
use <SensorBox.scad>
|
||
|
use <Vitamins.scad>
|
||
|
|
||
|
servo_mount_size = [12, 32, 2.5];
|
||
|
servo_mount_pos = [0, 0, 16];
|
||
|
servo_mount_hole_diam = 2;
|
||
|
servo_core_size = [12, 23, 22.3];
|
||
|
servo_gears_size = [servo_core_size.x, servo_core_size.x, 26.5];
|
||
|
servo_gears_pos = [0, -(servo_core_size.y/2 - servo_gears_size.y/2), 0];
|
||
|
servo_centergears_size = [servo_core_size.x/2, servo_core_size.x/2, servo_gears_size.z];
|
||
|
servo_centergears_pos = [0, 0, 0];
|
||
|
servo_shaft_size = [1, 1, 28.5];
|
||
|
servo_shaft_pos = servo_gears_pos;
|
||
|
display_pos = [0, 8, servo_core_size.z];
|
||
|
box_wall = 2;
|
||
|
servo_box_round = 1;
|
||
|
servo_box_size = [40, get_servo_box_size().y, servo_core_size.z + box_wall*2];
|
||
|
servo_box_chamber = [servo_box_size.x - box_wall*2, servo_box_size.y - box_wall*2, servo_box_size.z - box_wall*2];
|
||
|
servo_box_chamber_walled = [servo_box_chamber.x + box_wall, servo_box_chamber.y + box_wall, servo_box_chamber.z + box_wall];
|
||
|
servo_box_pos = [6, 0, servo_box_size.z/2 - box_wall];
|
||
|
servo_box_socket_size = [servo_box_size.x, servo_box_size.y, 4];
|
||
|
servo_box_screw_joiner_size = [5, 5, 20];
|
||
|
servo_box_screw_joiner_pos = [servo_box_size.x/2 + servo_box_screw_joiner_size.x/2, 0, 2];
|
||
|
|
||
|
module servo_mount_holes() {
|
||
|
for (i = [0:1]) {
|
||
|
down(servo_mount_size.z)
|
||
|
fwd((1-2*i)*(servo_mount_size.y/2 - servo_mount_hole_diam) + 0.5*(i+1))
|
||
|
cylinder(h=servo_mount_size.z*4, d=servo_mount_hole_diam, $fn=10);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module servo() {
|
||
|
up(servo_core_size.z/2)
|
||
|
cube(servo_core_size, center=true);
|
||
|
|
||
|
up(servo_mount_size.z/2) translate(servo_mount_pos)
|
||
|
difference() {
|
||
|
cube(servo_mount_size, center=true);
|
||
|
servo_mount_holes();
|
||
|
}
|
||
|
|
||
|
translate(servo_gears_pos) cylinder(d=servo_gears_size.x, h=servo_gears_size.z, $fn=30);
|
||
|
translate(servo_centergears_pos) cylinder(d=servo_centergears_size.x, h=servo_centergears_size.z, $fn=20);
|
||
|
|
||
|
translate(servo_shaft_pos) cylinder(d=servo_shaft_size.x, h=servo_shaft_size.z, $fn=20);
|
||
|
}
|
||
|
|
||
|
display_needle_length = 15;
|
||
|
module display_mount_holes() {
|
||
|
translate(-servo_shaft_pos) {
|
||
|
#servo_mount_holes();
|
||
|
}
|
||
|
}
|
||
|
module display() {
|
||
|
angle_max = 180;
|
||
|
angle_gap = 8;
|
||
|
|
||
|
module display_pie() {
|
||
|
up(1) zrot(-90 + angle_gap/2)
|
||
|
pie_slice(ang=angle_max-angle_gap, l=2, r=display_needle_length);
|
||
|
}
|
||
|
|
||
|
difference() {
|
||
|
//up(2/2) cube([20, 40, 2], center=true);
|
||
|
|
||
|
minkowski() {
|
||
|
display_pie();
|
||
|
cylinder(r=7,h=0.1);
|
||
|
}
|
||
|
up(1.5) display_pie();
|
||
|
translate(-servo_shaft_pos) {
|
||
|
down(servo_core_size.z) servo();
|
||
|
}
|
||
|
display_mount_holes();
|
||
|
}
|
||
|
slices=20;
|
||
|
for (i = [0:slices]) {
|
||
|
zrot(i * (angle_max - angle_gap)/slices + angle_gap/2) fwd(display_needle_length) up(3) scale(i%5==0 ? 1 : 0.5) cube([1, 4, 2], center=true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module servo_box() {
|
||
|
up(box_wall) translate(servo_box_pos) {
|
||
|
difference() {
|
||
|
cuboid(servo_box_size, chamfer=servo_box_round);
|
||
|
cuboid(servo_box_chamber, chamfer=servo_box_round);
|
||
|
}
|
||
|
translate(servo_box_screw_joiner_pos) {
|
||
|
fwd(20) screw_joiner(servo_box_screw_joiner_size, edges=EDGES_Z_RT);
|
||
|
back(20) screw_joiner(servo_box_screw_joiner_size, edges=EDGES_Z_RT);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module servo_box_divider(socket) {
|
||
|
up(3) {
|
||
|
difference() {
|
||
|
up(50 + servo_box_size.z/2 + 5) cube([500, 100, 100], center=true);
|
||
|
up(-box_wall) translate(servo_box_pos) scale(socket ? 1 : [0.97, 0.99, 0.98]) cube(servo_box_chamber_walled, center=true);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module model_display() {
|
||
|
up(box_wall) translate(display_pos) display();
|
||
|
}
|
||
|
|
||
|
module model_servo_box() {
|
||
|
difference() {
|
||
|
servo_box();
|
||
|
translate(display_pos) {
|
||
|
down(servo_core_size.z - 2) fwd(servo_gears_pos.y) servo();
|
||
|
display_mount_holes();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module model_servo_box_top() {
|
||
|
//up(box_wall + bank_inside_size.z/2)
|
||
|
intersection() {
|
||
|
model_servo_box();
|
||
|
servo_box_divider(socket=true);
|
||
|
}
|
||
|
model_display();
|
||
|
}
|
||
|
|
||
|
module model_servo_box_bottom() {
|
||
|
//up(box_wall + bank_inside_size.z/2)
|
||
|
difference() {
|
||
|
model_servo_box();
|
||
|
servo_box_divider(socket=false);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
translate(display_pos) down(servo_core_size.z - 4) fwd(servo_gears_pos.y) %servo();
|
||
|
|
||
|
model_servo_box_top();
|
||
|
model_servo_box_bottom();
|