|
- include <BOSL/constants.scad>
- use <BOSL/transforms.scad>
- use <BOSL/shapes.scad>
-
- xray = false;
- model = 1;
-
- pcb_pos = [0, 0, 6];
- pcb_size = [108, 63, 2];
- sensor_size = [pcb_size.x, pcb_size.y, 18 + 2];
- pcb_stand_diam = 5.2;
- pcb_hole_diam = 3;
-
- box_wall = 2;
- box_wall_rounding = 1;
- box_core_size = [sensor_size.x + 9 + box_wall*2, sensor_size.y + 3 + box_wall*2, sensor_size.z + box_wall*1.8];
- /*box_switchboard_size = [16, box_core_size.y, box_core_size.z];
- box_switchboard_chamber_pos = [(box_core_size.x + box_switchboard_size.x)/2 - 2*box_wall, 0, box_switchboard_size.z/2];
- box_switchboard_chamber_size = [box_switchboard_size.x + box_wall, box_switchboard_size.y - box_wall*2, box_switchboard_size.z - box_wall*3];*/
- box_cavity_size = [sensor_size.x + 4, sensor_size.y + 1, sensor_size.z + box_wall*2];
- box_lid_pos = [0, 0, sensor_size.z];
- box_lid_size = [115, 67.5, 1.7];
- box_pos = [/*box_switchboard_size.x/2*/0, 0, 0];
- box_size = [box_core_size.x /*+ box_switchboard_size.x*/, box_core_size.y, box_core_size.z];
-
- function get_servo_box_size() = box_size;
-
- module foreach_mount_hole() {
- for (x = [0:1]) {
- for (y = [0:1]) {
- left((1-2*x)*(pcb_size.x/2 - pcb_stand_diam/2 - pcb_hole_diam/4 + 0.5))
- fwd((1-2*y)*(pcb_size.y/2 - pcb_stand_diam/2 - pcb_hole_diam/4))
- children();
- }
- }
- }
-
- module pcb_mount_holes() {
- foreach_mount_hole() {
- cylinder(h=sensor_size.z, d=pcb_hole_diam, $fn=10);
- }
- }
-
- module pcb_stands() {
- foreach_mount_hole() {
- cylinder(h=sensor_size.z, d=pcb_stand_diam + 1.8, $fn=15);
- cylinder(h=sensor_size.z + 5.6, d=pcb_hole_diam + 1.0, $fn=10);
- }
- }
-
- module sensor_connectors_power() {
- pwr_diam=10;
- fwd(pcb_size.y/2 - 22.3) right(pcb_size.x/2 - 2) up(pcb_pos.z + 8.2) zrot(-90) xrot(-90) cylinder(h=50, d1=pwr_diam, d2=pwr_diam+2, $fn=20);
- }
-
- module sensor_connectors_space() {
- jack_diam=12;
- fwd(pcb_size.y/2 - 15.5) left(pcb_size.x/2 - 2) up(pcb_pos.z + 4) zrot(-90) xrot(90) cylinder(h=/*20*/7, d=jack_diam, $fn=20);
-
- //sensor_connectors_power();
-
- /*switch_size=[20, 8, 3.8];
- back(pcb_size.y/2 - 28.2) right(pcb_size.x/2 + switch_size.x/2 - 2) up(pcb_pos.z + switch_size.z/2 + 2.3) cube(switch_size, center=true);*/
-
- /*conn_size=[20, 8, 3.8];
- back(3) left(pcb_size.x/2 + conn_size.x/2 - 2) up(pcb_pos.z + conn_size.z/2 + 2.3) cube(conn_size, center=true);*/
- }
-
- module sensor() {
- difference() {
- translate(pcb_pos) up(pcb_size.z/2)
- cube(pcb_size, center=true);
- pcb_mount_holes();
- }
- pcb_stands();
- }
-
- module sensor_lid() {
- difference() {
- translate(box_lid_pos) up(box_lid_size.z/2)
- cube(box_lid_size, center=true);
- pcb_mount_holes();
- }
- }
-
- // ----
-
-
- module box() {
- difference() {
- translate(box_pos) up(box_size.z/2) cuboid(box_size, chamfer=box_wall_rounding);
- up(sensor_size.z/2 + box_wall*2.5) cube(box_cavity_size, center=true);
- up(box_lid_size.z/2 + box_wall) translate(box_lid_pos) cube(box_lid_size, center=true);
- up(box_wall) sensor_connectors_space();
- up(box_wall) pcb_stands();
- up(box_wall) up(sensor_size.z) xrot(180) pcb_stands();
-
- /*up(box_size.z - box_wall) {
- back(box_size.y/2 - 12) right(box_size.x/2 - 2) switch();
- back(box_size.y/2 - 32) right(box_size.x/2 - 2) switch();
- fwd(box_size.y/2 - 12) right(box_size.x/2 - 2) switch();
- }*/
- //translate(box_switchboard_chamber_pos) cuboid(box_switchboard_chamber_size, chamfer=1);
- }
- }
-
- module model_box() {
- box();
- }
-
- // ----
-
- if (xray) {
- intersection() {
- box();
- down(500) left(10) fwd(10) cube([1000, 1000, 1000]);
- }
- } else {
- box();
- }
- if (model == 0) {
- up(box_wall) union() {
- //sensor();
- //sensor_lid();
- %sensor_connectors_space();
- }
- }
|