123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- include <config.scad>;
-
- $fn = 42;
-
- module prism(l, w, h) {
- polyhedron(
- points = [[0,0,0], [l,0,0], [l,w,0], [0,w,0], [0,w,h], [l,w,h]],
- faces = [[0,1,2,3],[5,4,3,2],[0,4,5,1],[0,3,4],[5,2,1]]
- );
- }
-
- module roundedcylinder(d, h, r, top = false) {
- hull() // needed, otherwise rendering fails
- rotate_extrude(convexity = 10)
- translate([d / 2, 0, 0])
- rotate([0, 180, 0]) {
- if (top) {
- translate([0, r])
- square([d / 2, h - r * 2]);
- } else {
- translate([0, r])
- square([d / 2, h - r]);
- }
-
- //translate([r, 0])
- //square([d / 2 - r, r]);
-
- translate([r, r])
- circle(r = r);
-
- if (top) {
- translate([r, h - r])
- circle(r = r);
-
- //translate([r, h - r])
- //square([d / 2 - r, r]);
- }
- }
- }
-
- module rail_2020(l, n = "") {
- translate([0, 10, 10])
- difference() {
- translate([0, -10, -10])
- cube([l, 20, 20]);
-
- translate([-1, 0, 0])
- rotate([0, 90, 0])
- cylinder(d = 4.2, h = l + 2);
-
- for (i = [0, 90, 180, 270])
- rotate([i, 0, 0]) {
- translate([-1, -6.25 / 2, 10 - 4.3 - 1.8])
- cube([l + 2, 6.25, 4.3 + 1.8 + 1]);
-
- for (j = [-1, 1])
- scale([1, j, 1])
- translate([-1, -6.25 / 2, 10 - 1.8])
- rotate([45, 0, 0])
- cube([l + 2, 6.25, 4.3 + 1.8 + 1]);
- }
- }
- }
-
- module rail_2020_x(l, n = "") {
- echo("2020 rail", n, str(l));
- rail_2020(l, n);
- }
-
- module rail_2020_y(l, n = "") {
- translate([20, 0, 0])
- rotate([0, 0, 90])
- rail_2020_x(l, n);
- }
-
- module rail_2040_x(l, n = "") {
- echo("2040 rail", n, str(l));
- rail_2020(l, n);
- translate([0, 0, -20])
- rail_2020(l, n);
- }
-
- module rail_2040_y(l, n = "") {
- translate([20, 0, 0])
- rotate([0, 0, 90])
- rail_2040_x(l, n);
- }
-
- module rail_wheel() {
- difference() {
- union() {
- cylinder(d1 = rail_wheel_mid, d2 = rail_wheel_outer, h = (rail_wheel_height - rail_wheel_center_height) / 2);
-
- translate([0, 0, (rail_wheel_height - rail_wheel_center_height) / 2])
- cylinder(d = rail_wheel_outer, h = rail_wheel_center_height);
-
- translate([0, 0, (rail_wheel_height - rail_wheel_center_height) / 2 + rail_wheel_center_height])
- cylinder(d1 = rail_wheel_outer, d2 = rail_wheel_mid, h = (rail_wheel_height - rail_wheel_center_height) / 2);
- }
- translate([0, 0, -1])
- cylinder(d = rail_wheel_inner, rail_wheel_height + 2);
- }
- }
-
- module nema17_holes_face(height, length, hole) {
- translate([nema17_size / 2, nema17_size / 2, height - 4.5])
- for (i = [1, -1])
- for (j = [1, -1])
- translate([i * nema17_hole_off, j * nema17_hole_off, 0])
- cylinder(d = hole, h = length);
- }
-
- module nema17(length) {
- difference() {
- cube([nema17_size, nema17_size, length]);
- nema17_holes_face(length, 5.0, nema17_hole_size);
- }
-
- translate([nema17_size / 2, nema17_size / 2, length]) {
- cylinder(d = nema17_center_size, h = nema17_center_height);
- cylinder(d = nema17_shaft_size, h = nema17_shaft_length);
- }
- }
-
- module endstop_pcb() {
- difference() {
- cube([endstop_pcb_width, endstop_pcb_depth, endstop_pcb_height]);
-
- for (i = [0, 1])
- translate([endstop_pcb_hole_dist_x, -1, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
- rotate([-90, 0, 0])
- cylinder(d = endstop_pcb_hole, h = endstop_pcb_depth + 2);
- }
-
- translate([0, 0, endstop_pcb_height - endstop_pcb_switchpoint])
- rotate([0, -90, 0])
- cylinder(d = endstop_pcb_hole, h = endstop_pcb_switchpoint);
- }
-
- module endstop_mount_v1() {
- %color("yellow")
- translate([-endstop_pcb_mount_off_w, -endstop_pcb_depth - endstop_pcb_mount_off_d, endstop_pcb_mount_off_h])
- endstop_pcb();
-
- color("blue")
- difference() {
- cube([endstop_mount_width, endstop_mount_depth, 40]);
-
- for (i = [0, 1])
- translate([endstop_mount_width / 2, -1, 10 + 20 * i])
- rotate([-90, 0, 0])
- cylinder(d = motor_mount_hole_size, h = endstop_mount_depth + 2);
- }
-
- color("blue")
- difference() {
- union() {
- hull() {
- translate([-endstop_mount_slot_length, 0, 40 - endstop_mount_add_height])
- cube([endstop_mount_slot_length, endstop_mount_depth, endstop_mount_add_height]);
-
- for (i = [0, 1])
- translate([0, 0, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
- translate([-endstop_pcb_mount_off_w, -endstop_pcb_mount_off_d, endstop_pcb_mount_off_h - endstop_mount_slot_width / 2])
- cube([endstop_mount_slot_length, endstop_mount_slot_depth, endstop_mount_slot_width]);
- }
- }
-
- translate([-endstop_pcb_mount_off_w, -endstop_pcb_depth - endstop_pcb_mount_off_d, endstop_pcb_mount_off_h])
- for (i = [0, 1])
- translate([endstop_pcb_hole_dist_x, -1, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
- rotate([-90, 0, 0]) {
- cylinder(d = endstop_pcb_hole, h = endstop_pcb_depth + 20);
-
- translate([0, 0, 1 + endstop_pcb_depth + endstop_mount_slot_depth])
- cylinder(d = endstop_mount_nut_hole, h = 20, $fn = 6);
- }
- }
- }
-
- module endstop_mount_v2() {
- %color("yellow")
- translate([-endstop_pcb_mount_off_w, -endstop_pcb_depth - endstop_pcb_mount_off_d, endstop_pcb_mount_off_h])
- endstop_pcb();
-
- color("blue")
- difference() {
- cube([endstop_mount_width, endstop_mount_depth, 40]);
-
- for (i = [0, 1])
- translate([endstop_mount_width / 2, -1, 10 + 20 * i])
- rotate([-90, 0, 0])
- cylinder(d = motor_mount_hole_size, h = endstop_mount_depth + 2);
- }
-
- color("blue")
- difference() {
- union() {
- hull() {
- translate([-endstop_mount_slot_length, 0, 40 - endstop_mount_add_height])
- cube([endstop_mount_slot_length, endstop_mount_depth, endstop_mount_add_height]);
-
- translate([0, 0, endstop_pcb_height - endstop_pcb_hole_dist_y - endstop_pcb_hole_dist])
- translate([-endstop_pcb_mount_off_w, -endstop_pcb_mount_off_d, endstop_pcb_mount_off_h - endstop_mount_slot_width / 2])
- cube([endstop_mount_slot_length, endstop_mount_slot_depth, endstop_mount_slot_width]);
- }
-
- hull() {
- for (i = [0, 1])
- translate([0, 0, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
- translate([-endstop_pcb_mount_off_w, -endstop_pcb_mount_off_d, endstop_pcb_mount_off_h - endstop_mount_slot_width / 2])
- cube([endstop_mount_slot_length, endstop_mount_slot_depth, endstop_mount_slot_width]);
- }
- }
-
- translate([-endstop_pcb_mount_off_w, -endstop_pcb_depth - endstop_pcb_mount_off_d, endstop_pcb_mount_off_h])
- for (i = [0, 1])
- translate([endstop_pcb_hole_dist_x, -1, endstop_pcb_height - endstop_pcb_hole_dist_y - i * endstop_pcb_hole_dist])
- rotate([-90, 0, 0]) {
- cylinder(d = endstop_pcb_hole, h = endstop_pcb_depth + 20);
-
- translate([0, 0, 1 + endstop_pcb_depth + endstop_mount_slot_depth])
- cylinder(d = endstop_mount_nut_hole, h = 20, $fn = 6);
- }
- }
- }
-
- module endstop_mount() {
- if (use_endstop_mount_v2) {
- endstop_mount_v2();
- } else {
- endstop_mount_v1();
- }
- }
-
- module dispenser_arm() {
- translate([0, dispenser_arm_tab_off, dispenser_arm_tab_hole_off])
- rotate([90, 0, 0])
- cylinder(d = dispenser_arm_dia, h = dispenser_arm_len);
-
- translate([0, dispenser_arm_tab_off, dispenser_arm_tab_hole_off - dispenser_arm_height])
- cylinder(d = dispenser_arm_dia, h = dispenser_arm_height);
-
- translate([-dispenser_arm_handle_width / 2, dispenser_arm_tab_off - dispenser_arm_len - dispenser_arm_handle_len + dispenser_arm_handle_overlap, dispenser_arm_tab_hole_off + dispenser_arm_dia / 2])
- cube([dispenser_arm_handle_width, dispenser_arm_handle_len, dispenser_arm_handle_height]);
- }
-
- module dispenser() {
- difference() {
- cylinder(d1 = dispenser_nozzle_end_dia_1, d2 = dispenser_nozzle_end_dia_2, h = dispenser_nozzle_end_length);
- translate([0, 0, -0.01])
- cylinder(d1 = dispenser_nozzle_end_dia_1 - dispenser_wall * 2, d2 = dispenser_nozzle_end_dia_2 - dispenser_wall * 2, h = dispenser_nozzle_end_length + 0.02);
- }
-
- translate([0, 0, dispenser_nozzle_end_length])
- difference() {
- cylinder(d1 = dispenser_nozzle_cap_dia_1, d2 = dispenser_nozzle_cap_dia_2, h = dispenser_nozzle_cap_height);
- translate([0, 0, -0.01])
- cylinder(d1 = dispenser_nozzle_cap_dia_1 - dispenser_wall * 2, d2 = dispenser_nozzle_cap_dia_2 - dispenser_wall * 2, h = dispenser_nozzle_cap_height + 0.02);
- }
-
- translate([0, 0, dispenser_nozzle_end_length + dispenser_nozzle_cap_height])
- difference() {
- cylinder(d = dispenser_nozzle_mid_dia, h = dispenser_nozzle_mid_height);
- translate([0, 0, -0.01])
- cylinder(d = dispenser_nozzle_mid_dia - dispenser_wall * 2, h = dispenser_nozzle_mid_height + 0.02);
- }
-
- translate([0, 0, dispenser_nozzle_end_length + dispenser_nozzle_cap_height + dispenser_nozzle_mid_height])
- difference() {
- cylinder(d = dispenser_nozzle_top_dia, h = dispenser_nozzle_top_height);
- translate([0, 0, -0.01])
- cylinder(d = dispenser_nozzle_top_dia - dispenser_wall * 2, h = dispenser_nozzle_top_height + 0.02);
- }
-
- translate([0, 0, dispenser_nozzle_end_length + dispenser_nozzle_cap_height + dispenser_nozzle_mid_height + dispenser_nozzle_top_height])
- difference() {
- cylinder(d1 = dispenser_mid_dia, d2 = dispenser_top_dia, h = dispenser_top_height);
- translate([0, 0, -0.01])
- cylinder(d1 = dispenser_mid_dia - dispenser_wall * 2, d2 = dispenser_top_dia - dispenser_wall * 2, h = dispenser_top_height + 0.02);
- }
-
- translate([0, -dispenser_top_dia / 2, dispenser_nozzle_end_length + dispenser_nozzle_cap_height + dispenser_nozzle_mid_height + dispenser_nozzle_top_height + dispenser_top_height])
- rotate([dispenser_handle_angle, 0, 0])
- translate([0, 0, -dispenser_handle_dia / 2])
- rotate([90, 0, 0])
- cylinder(d = dispenser_handle_dia, h = dispenser_handle_length);
-
- translate([0, dispenser_top_dia / 2 + dispenser_arm_handle_y, dispenser_nozzle_end_length + dispenser_nozzle_cap_height + dispenser_nozzle_mid_height + dispenser_nozzle_top_height + dispenser_top_height + dispenser_arm_handle_z])
- rotate([dispenser_arm_angle_bottom + (-anim_pos_extruder + 1) * (dispenser_arm_angle_top - dispenser_arm_angle_bottom), 0, 0])
- dispenser_arm();
- }
-
- //endstop_pcb();
- endstop_mount();
-
- //dispenser();
|