zwave-2002-lock/scad/base_plate_inside.scad
Christoffer Martinsson 58a57dceef Added outer base plate
2018-02-20 14:11:41 +01:00

135 lines
6.7 KiB
OpenSCAD

$fn=30;
top_r = 5;
wall = 3;
bottom = 5;
height = 200;
width = 70;
top_box_height = 59+6;
top_box_depth = 27;
top_box_position = 175;
lock_box_height = 27+6;
lock_box_depth = 45;
lock_box_position = 50;
key_inner_diameter = 40;
key_outer_diameter = 57;
key_depth = 2;
key_position = 111;
handle_inner_diameter = 40;
handle_outer_diameter = 52;
handle_depth = 2;
handle_position = 0;
lock_diameter = 10;
lock_position = 50;
cable_lock_cutout_diameter = 13;
cable_lock_width = 10;
cable_lock_heigh = 2;
cable_lock_pos_1 = key_position;
cable_lock_pos_2 = top_box_position - 18;
cable_motor_cutout_diameter = 10;
cable_motor_width = 5;
cable_motor_heigh = 2;
cable_motor_pos_1 = lock_position;
cable_motor_pos_2 = top_box_position- 20;
m3_nut_hole_height = 3.2;
m3_nut_hole_width = 5.8;
light_guide_diameter = 2.5+0.2;
pcb_distance_width = 5;
pcb_distance_z = 4;
pcb_distance_hole = 2;
servo_width = 40;
servo_height = 20;
servo_depth = 10;
servo_wall = 2;
servo_hole = 2.5;
servo_hole_cc_x = 47.26;
servo_hole_cc_y = 10.17;
screw_cutout_width = 8;
screw_cutout_cc = 45;
module cover (){
// Main mounting plate
difference(){
union(){
// top box
translate([0,top_box_position,top_box_depth/2])minkowski(){
cube([width-top_r*2, top_box_height-top_r*2, top_box_depth-1], center=true);
cylinder(r=top_r, h=1, center=true);
}
// Lock/Motor box
translate([0,lock_position,lock_box_depth/2])minkowski(){
cube([width-top_r*2, lock_box_height-top_r*2, lock_box_depth-1], center=true);
cylinder(r=top_r, h=1, center=true);
}
// Bottom plate
translate([0,(height-(width/2)-top_r)/2,bottom/2])cube([width, height-(width/2)-top_r, bottom], center = true);
translate([0,0,bottom/2])cylinder(r = width/2, h = bottom, center = true, $fn=100);
}
// Handle cutout
translate([0,handle_position,bottom/2])cylinder(r = handle_inner_diameter/2, h = bottom, center = true, $fn=100);
translate([0,handle_position,bottom/2+bottom/2-handle_depth/2])cylinder(r = handle_outer_diameter/2, h = handle_depth, center = true, $fn=100);
// Key cutout
translate([0,key_position,bottom/2])cylinder(r = key_inner_diameter/2, h = bottom, center = true, $fn=100);
translate([0,key_position,bottom/2+bottom/2-key_depth/2])cylinder(r = key_outer_diameter/2, h = key_depth, center = true, $fn=100);
// lock/motor cutout
translate([0,lock_position,bottom/2])cylinder(r = lock_diameter/2, h = bottom, center = true, $fn=100);
// Sensor cable cutout
translate([0,cable_lock_pos_2,bottom/2])cylinder(r = cable_lock_cutout_diameter/2, h = bottom, center = true, $fn=100);
translate([0,cable_lock_pos_1+(cable_lock_pos_2-cable_lock_pos_1)/2,cable_lock_heigh/2])cube([cable_lock_width,cable_lock_pos_2-cable_lock_pos_1,cable_lock_heigh], center = true);
// Motor cable cutout
translate([-25,cable_motor_pos_1,(bottom+servo_depth)/2])cylinder(r = cable_motor_cutout_diameter/2, h = bottom+servo_depth, center = true, $fn=100);
translate([-25,cable_motor_pos_2,top_box_depth/2])cylinder(r = cable_motor_cutout_diameter/2, h = top_box_depth, center = true, $fn=100);
translate([-25,cable_motor_pos_1+(cable_motor_pos_2-cable_motor_pos_1)/2,cable_motor_heigh/2])cube([cable_motor_width,cable_motor_pos_2-cable_motor_pos_1,cable_motor_heigh], center = true);
// Motor cutout
translate([0,lock_position,(lock_box_depth+servo_depth+servo_wall)/2])cube([width-wall*2-1, lock_box_height-wall*4, lock_box_depth-servo_depth-servo_wall], center=true);
translate([0,lock_position,lock_box_depth-wall/2])cube([width-wall*2, lock_box_height-wall*2, wall], center=true);
translate([20-9.66-0.5,lock_position,servo_depth/2+servo_wall])cube([servo_width, servo_height, servo_depth], center=true);
// Motor mount holes
translate([-13.47-1.5,lock_position+servo_hole_cc_y/2,servo_depth/2+servo_wall])cylinder(r = servo_hole/2, h = servo_depth, center=true);
translate([-13.47-1.5,lock_position-servo_hole_cc_y/2,servo_depth/2+servo_wall])cylinder(r = servo_hole/2, h = servo_depth, center=true);
// Motor box screw cutout
translate([screw_cutout_cc/2,lock_box_position,lock_box_depth-wall/2])cube([screw_cutout_width, lock_box_height, wall], center=true);
translate([-screw_cutout_cc/2,lock_box_position,lock_box_depth-wall/2])cube([screw_cutout_width, lock_box_height, wall], center=true);
translate([-screw_cutout_cc/2,lock_box_position+lock_box_height/2-wall,lock_box_depth-wall-servo_depth/2])cylinder(r=servo_hole/2, h = servo_depth, center=true);
translate([screw_cutout_cc/2,lock_box_position+lock_box_height/2-wall,lock_box_depth-wall-servo_depth/2])cylinder(r=servo_hole/2, h = servo_depth, center=true);
translate([-screw_cutout_cc/2,lock_box_position-lock_box_height/2+wall,lock_box_depth-wall-servo_depth/2])cylinder(r=servo_hole/2, h = servo_depth, center=true);
translate([screw_cutout_cc/2,lock_box_position-lock_box_height/2+wall,lock_box_depth-wall-servo_depth/2])cylinder(r=servo_hole/2, h = servo_depth, center=true);
// Top box cutout
translate([0,top_box_position,(top_box_depth-bottom-3)/2+bottom+pcb_distance_z/2])cube([width-wall*2-1, top_box_height-wall*4, top_box_depth-bottom+3-pcb_distance_z], center=true);
translate([0,top_box_position,top_box_depth-wall/2])cube([width-wall*2, top_box_height-wall*2, wall], center=true);
translate([0,top_box_position,(pcb_distance_z)/2+bottom-3])cube([width-wall*2-5, top_box_height-wall*4-4, pcb_distance_z], center=true);
// Power cutout
translate([26,top_box_position+top_box_height/2-(wall*2+2)/2,(pcb_distance_z-1)/2+2])cube([6, wall*2+2, pcb_distance_z-1], center=true);
// Top box screw cutout
translate([screw_cutout_cc/2,top_box_position,top_box_depth-wall/2])cube([screw_cutout_width, top_box_height, wall], center=true);
translate([-screw_cutout_cc/2,top_box_position,top_box_depth-wall/2])cube([screw_cutout_width, top_box_height, wall], center=true);
translate([-screw_cutout_cc/2,top_box_position+top_box_height/2-wall,top_box_depth-wall-servo_depth/2])cylinder(r=servo_hole/2, h = servo_depth, center=true);
translate([screw_cutout_cc/2,top_box_position+top_box_height/2-wall,top_box_depth-wall-servo_depth/2])cylinder(r=servo_hole/2, h = servo_depth, center=true);
translate([-screw_cutout_cc/2,top_box_position-top_box_height/2+wall,top_box_depth-wall-servo_depth/2])cylinder(r=servo_hole/2, h = servo_depth, center=true);
translate([screw_cutout_cc/2,top_box_position-top_box_height/2+wall,top_box_depth-wall-servo_depth/2])cylinder(r=servo_hole/2, h = servo_depth, center=true);
}
// PCB mounting
translate([0,top_box_position,bottom])difference(){
union(){
translate([-2.54*1.5,2.54*0.5,pcb_distance_z/2-3])cylinder(r = pcb_distance_width/2, h = pcb_distance_z, center = true);
}
translate([-2.54*1.5,2.54*0.5,pcb_distance_z/2-3])cylinder(r = pcb_distance_hole/2, h = pcb_distance_z, center = true);
}
}
cover();