animation_pegbar/scad/pegbar.scad

198 lines
6.0 KiB
OpenSCAD
Raw Permalink Normal View History

2025-02-08 04:20:28 +00:00
use <./common/common.scad>;
$fn = 160;
ROUND_L = 254;
ROUND_W = 13;
ROUND_H = 3;
ACME_L = 254;
ACME_W = 13;
ACME_H = 3;
DISNEY_L = 254;
DISNEY_W = 13;
DISNEY_H = 3;
OXBERRY_L = 254;
OXBERRY_W = 13;
OXBERRY_H = 3;
ROUND_PEG_D = 6.39;
PEG_H = 9.76;
ACME_PEG_D = 3.24;
ACME_PEG_L = 11.92;
OXBERRY_PEG_D = 6.39;
OXBERRY_PEG_L = 11.92;
ROUND_PEG_SPACING = 108 * 2;
ACME_PEG_SPACING = 192;
OXBERRY_PEG_SPACING = 192;
DISNEY_PEG_SPACING = 7 * 25.4;
2025-02-08 04:20:28 +00:00
//http://www.cartoonsupplies.com/content/acme-pegbar-plastic
module rounded_bar (arr = [50, 10, 10], fn = 60) {
$fn = fn;
cube([arr[0] - arr[1], arr[1], arr[2]], center = true);
translate ([(arr[0] / 2) - (arr[1] / 2), 0, 0]) {
cylinder(r = R(arr[1]), h = arr[2], center = true);
}
translate ([-(arr[0] / 2) + (arr[1] / 2), 0, 0]) {
cylinder(r = R(arr[1]), h = arr[2], center = true);
}
}
module round_peg (pos = [0, 0, 0], D = 6, H = 9) {
translate(pos) {
cylinder(r = R(D), h = H - (D / 2), center = true);
translate([0, 0, (H / 2) - (D / 4)]) {
difference () {
sphere(r = R(D));
translate([0, 0, -D]) cube([D*2, D*2, D*2], center = true);
}
2025-02-08 04:20:28 +00:00
}
}
}
module enlongated_peg (pos = [0, 0, 0], D = 3, L = 11, H = 9) {
translate(pos) {
rounded_bar([L, D, H - (D / 2)], fn = $fn);
translate([0, 0, (H / 2) - (D / 4)]) {
difference () {
union () {
rotate([0, 90, 0]) cylinder(r = R(D), h = L - D, center = true);
translate([(L / 2) - (D / 2), 0, 0]) sphere(r = R(D));
translate([-(L / 2) + (D / 2), 0, 0]) sphere(r = R(D));
}
translate([0, 0, -L]) cube([L * 2, L * 2, L * 2], center = true);
2025-02-08 04:20:28 +00:00
}
}
}
}
module pegbar_round () {
rounded_bar([ROUND_L, ROUND_W, ROUND_H], $fn);
round_peg([0, 0, (PEG_H / 2) - .5], ROUND_PEG_D, PEG_H);
round_peg([(ROUND_PEG_SPACING / 2), 0, (PEG_H / 2) ], ROUND_PEG_D, PEG_H);
round_peg([-(ROUND_PEG_SPACING / 2), 0, (PEG_H / 2) ], ROUND_PEG_D, PEG_H);
}
module pegbar_acme () {
rounded_bar([ACME_L, ACME_W, ACME_H], $fn);
round_peg([0, 0, (PEG_H / 2) - .5], ROUND_PEG_D, PEG_H);
enlongated_peg([(ACME_PEG_SPACING / 2) + (ACME_PEG_L / 2), 0, (PEG_H / 2) + .3 ], ACME_PEG_D, ACME_PEG_L, PEG_H);
enlongated_peg([-(ACME_PEG_SPACING / 2) - (ACME_PEG_L / 2), 0, (PEG_H / 2) + .3 ], ACME_PEG_D, ACME_PEG_L, PEG_H);
}
module pegbar_oxberry () {
rounded_bar([OXBERRY_L, OXBERRY_W, OXBERRY_H], $fn);
round_peg([0, 0, (PEG_H / 2) - .5], ROUND_PEG_D, PEG_H);
enlongated_peg([(OXBERRY_PEG_SPACING / 2) + (OXBERRY_PEG_L / 2), 0, (PEG_H / 2) + .3 ], OXBERRY_PEG_D, OXBERRY_PEG_L, PEG_H);
enlongated_peg([-(OXBERRY_PEG_SPACING / 2) - (OXBERRY_PEG_L / 2), 0, (PEG_H / 2) + .3 ], OXBERRY_PEG_D, OXBERRY_PEG_L, PEG_H);
}
//Disney uses ACME pegs
module pegbar_disney () {
rounded_bar([DISNEY_L, DISNEY_W, DISNEY_H], $fn);
round_peg([0, 0, (PEG_H / 2) - .5], ROUND_PEG_D, PEG_H);
enlongated_peg([(DISNEY_PEG_SPACING / 2) + (ACME_PEG_L / 2), 0, (PEG_H / 2) + .3 ], ACME_PEG_D, ACME_PEG_L, PEG_H);
enlongated_peg([-(DISNEY_PEG_SPACING / 2) - (ACME_PEG_L / 2), 0, (PEG_H / 2) + .3 ], ACME_PEG_D, ACME_PEG_L, PEG_H);
}
module two_piece () {
2025-02-08 04:20:28 +00:00
difference () {
children();
2025-02-08 04:20:28 +00:00
translate([150 + 20, 0, 0]) cube([300, 300, 300], center = true);
translate([20, 0, .75]) {
difference (){
cube([5, 13 + 1, 1.5], center = true);
cube([5, 4, 10], center = true);
}
}
}
translate([20, 20, 0]) {
difference () {
children();
2025-02-08 04:20:28 +00:00
translate([150 - 20, 0, 0]) cube([300, 300, 300], center = true);
translate([-20, 0, -.75]) {
cube([5, 13 + 1, 1.5], center = true);
cube([5, 4, 10], center = true);
}
}
}
}
module three_piece () {
2025-02-08 04:20:28 +00:00
difference () {
children();
2025-02-08 04:20:28 +00:00
translate([150 + (254 / 6), 0, 0]) cube([300, 300, 300], center = true);
translate([-150 - (254 / 6), 0, 0]) cube([300, 300, 300], center = true);
translate([(254 / 6), 0, .75]) {
difference () {
cube([5, 13 + 1, 1.5], center = true);
cube([5, 4, 10], center = true);
}
}
translate([-(254 / 6), 0, .75]) {
difference () {
cube([5, 13 + 1, 1.5], center = true);
cube([5, 4, 10], center = true);
}
}
}
translate([(254 / 3), 20, 0]) {
difference () {
children();
2025-02-08 04:20:28 +00:00
translate([150 - (254 / 6), 0, 0]) cube([300, 300, 300], center = true);
translate([-(254 / 6), 0, -.75]) {
cube([5, 13 + 1, 1.5], center = true);
cube([5, 4, 10], center = true);
}
}
}
translate([(254 / 3), -20, 0]) {
difference () {
children();
2025-02-08 04:20:28 +00:00
translate([150 - (254 / 6), 0, 0]) cube([300, 300, 300], center = true);
translate([-(254 / 6), 0, -.75]) {
cube([5, 13 + 1, 1.5], center = true);
cube([5, 4, 10], center = true);
}
}
}
}
PART = "round";
2025-02-08 04:20:28 +00:00
if (PART == "round") {
pegbar_round();
} else if (PART == "acme") {
pegbar_acme();
} else if (PART == "disney") {
pegbar_disney();
} else if (PART == "oxberry") {
pegbar_oxberry();
} else if (PART == "round_two_piece") {
two_piece() pegbar_round();
} else if (PART == "round_three_piece") {
three_piece() pegbar_round();
} else if (PART == "acme_two_piece") {
two_piece() pegbar_acme();
} else if (PART == "acme_three_piece") {
three_piece() pegbar_acme();
} else if (PART == "disney_two_piece") {
two_piece() pegbar_disney();
} else if (PART == "disney_three_piece") {
three_piece() pegbar_disney();
} else if (PART == "oxberry_two_piece") {
two_piece() pegbar_oxberry();
} else if (PART == "oxberry_three_piece") {
three_piece() pegbar_oxberry();
2025-02-08 04:20:28 +00:00
}
//
//