1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-09 00:06:42 +02:00
This commit is contained in:
Justin Lin
2019-09-19 08:48:53 +08:00
parent d0712918a2
commit e87321fc32
3 changed files with 28 additions and 28 deletions

View File

@@ -4,7 +4,7 @@ t = "1000 followers";
head_size = 30; head_size = 30;
qr_thickness = 1.5; qr_thickness = 1.5;
shaft_r = 2.5; peg_radius = 2.5;
spacing = 0.5; spacing = 0.5;
min_error_correction_level = "medium"; // [low, medium, quartile, high] min_error_correction_level = "medium"; // [low, medium, quartile, high]
@@ -34,7 +34,7 @@ module cube_character(head_size) {
translate([0, -half_head_size, half_head_size]) translate([0, -half_head_size, half_head_size])
rotate([-90, 0, 0]) rotate([-90, 0, 0])
connector_peg(shaft_r, spacing, void = true); connector_peg(peg_radius, spacing, void = true);
} }
} }
@@ -45,7 +45,7 @@ module cube_character(head_size) {
module peg_void() { module peg_void() {
translate([half_body_size + 1, head_size * 0.2, half_body_size]) translate([half_body_size + 1, head_size * 0.2, half_body_size])
rotate([0, -90, 0]) rotate([0, -90, 0])
connector_peg(shaft_r, spacing, void = true); connector_peg(peg_radius, spacing, void = true);
} }
difference() { difference() {
@@ -62,7 +62,7 @@ module cube_character(head_size) {
// holes // holes
translate([0, half_body_size + 1, half_body_size]) translate([0, half_body_size + 1, half_body_size])
rotate([90, 0, 0]) rotate([90, 0, 0])
connector_peg(shaft_r, spacing, void = true); connector_peg(peg_radius, spacing, void = true);
peg_void(); peg_void();
mirror([1, 0, 0]) peg_void(); mirror([1, 0, 0]) peg_void();
@@ -81,7 +81,7 @@ module cube_character(head_size) {
translate([head_size * 0.1375, head_size * 0.1375, half_body_size / 2]) translate([head_size * 0.1375, head_size * 0.1375, half_body_size / 2])
rotate([0, 90, 0]) rotate([0, 90, 0])
connector_peg(shaft_r, spacing); connector_peg(peg_radius, spacing);
} }
} }
@@ -95,7 +95,7 @@ module cube_character(head_size) {
body(); body();
translate([0, head_size * 0.75]) translate([0, head_size * 0.75])
connector_peg(shaft_r, spacing, heads = true); connector_peg(peg_radius, spacing, heads = true);
} }
// refactored from https://www.thingiverse.com/thing:258542 // refactored from https://www.thingiverse.com/thing:258542

View File

@@ -20,7 +20,7 @@ spring_levels = 20;
line_thickness = 4; line_thickness = 4;
line_distance = 1.5; line_distance = 1.5;
shaft_r = 2.5; peg_radius = 2.5;
plate_h = 6; plate_h = 6;
spacing = 0.4; spacing = 0.4;
@@ -50,7 +50,7 @@ module toy_spring(radius, levels, sides, line_thickness, line_distance) {
} }
module dog_back(head_r, shaft_r) { module dog_back(head_r, peg_radius) {
$fn = 36; $fn = 36;
module foot() { module foot() {
@@ -105,10 +105,10 @@ module dog_back(head_r, shaft_r) {
color("Goldenrod") translate([0, -head_r * 0.2, 0]) color("Goldenrod") translate([0, -head_r * 0.2, 0])
rotate([90, 0, 0]) rotate([90, 0, 0])
connector_peg(shaft_r, spacing); connector_peg(peg_radius, spacing);
} }
module spring_dog_spring(head_r, spring_levels, line_thickness, line_distance, shaft_r, plate_h, spacing) { module spring_dog_spring(head_r, spring_levels, line_thickness, line_distance, peg_radius, plate_h, spacing) {
spring_sides = 36; spring_sides = 36;
h = spring_levels * line_thickness; h = spring_levels * line_thickness;
@@ -116,7 +116,7 @@ module spring_dog_spring(head_r, spring_levels, line_thickness, line_distance, s
difference() { difference() {
linear_extrude(plate_h + spacing) linear_extrude(plate_h + spacing)
circle(head_r); circle(head_r);
connector_peg(shaft_r, spacing, void = true, $fn = spring_sides); connector_peg(peg_radius, spacing, void = true, $fn = spring_sides);
} }
} }
@@ -125,7 +125,7 @@ module spring_dog_spring(head_r, spring_levels, line_thickness, line_distance, s
circle(head_r); circle(head_r);
translate([0, 0, plate_h + spacing]) translate([0, 0, plate_h + spacing])
connector_peg(shaft_r, spacing, $fn = spring_sides); connector_peg(peg_radius, spacing, $fn = spring_sides);
} }
color("yellow") { color("yellow") {
@@ -144,7 +144,7 @@ module spring_dog_spring(head_r, spring_levels, line_thickness, line_distance, s
} }
} }
module dog_front(head_r, shaft_r, spacing) { module dog_front(head_r, peg_radius, spacing) {
$fn = 36; $fn = 36;
module head() { module head() {
@@ -303,24 +303,24 @@ module dog_front(head_r, shaft_r, spacing) {
difference() { difference() {
front(); front();
translate([0, head_r * 0.209, 0]) rotate([90, 0, 0]) translate([0, head_r * 0.209, 0]) rotate([90, 0, 0])
connector_peg(shaft_r, spacing, void = true, $fn = 36); connector_peg(peg_radius, spacing, void = true, $fn = 36);
} }
} }
if(part == "FRONT") { if(part == "FRONT") {
dog_front(head_radius, shaft_r, spacing); dog_front(head_radius, peg_radius, spacing);
} else if(part == "SPRING") { } else if(part == "SPRING") {
spring_dog_spring(head_radius, spring_levels, line_thickness, line_distance, shaft_r, plate_h, spacing); spring_dog_spring(head_radius, spring_levels, line_thickness, line_distance, peg_radius, plate_h, spacing);
} else if(part == "BACK") { } else if(part == "BACK") {
dog_back(head_radius, shaft_r); dog_back(head_radius, peg_radius);
} }
else { else {
dog_front(head_radius, shaft_r, spacing); dog_front(head_radius, peg_radius, spacing);
translate([0, spring_levels * (line_thickness + line_distance) + plate_h + spacing, 0]) { translate([0, spring_levels * (line_thickness + line_distance) + plate_h + spacing, 0]) {
rotate([90, 0, 0]) rotate([90, 0, 0])
spring_dog_spring(head_radius, spring_levels, line_thickness, line_distance, shaft_r, plate_h, spacing); spring_dog_spring(head_radius, spring_levels, line_thickness, line_distance, peg_radius, plate_h, spacing);
translate([0, 3.25, 0]) dog_back(head_radius, shaft_r); translate([0, 3.25, 0]) dog_back(head_radius, peg_radius);
} }
} }

View File

@@ -1,25 +1,25 @@
module connector_peg(shaft_r = 2.5, spacing = 0.5, void = false, heads = false) { module connector_peg(radius = 2.5, spacing = 0.5, void = false, heads = false) {
lip_r = shaft_r * 1.2; lip_r = radius * 1.2;
height = shaft_r * 2.6; height = radius * 2.6;
r_diff = lip_r - shaft_r; r_diff = lip_r - radius;
h_unit = height / 7; h_unit = height / 7;
d_h_unit = h_unit * 2; d_h_unit = h_unit * 2;
half_h_unit = h_unit / 2; half_h_unit = h_unit / 2;
module base(shaft_r, lip_r) { module base(radius, lip_r) {
rotate_extrude() { rotate_extrude() {
translate([0, -d_h_unit + height]) hull() { translate([0, -d_h_unit + height]) hull() {
square([lip_r - r_diff, d_h_unit]); square([lip_r - r_diff, d_h_unit]);
translate([0, half_h_unit]) translate([0, half_h_unit])
square([lip_r, half_h_unit]); square([lip_r, half_h_unit]);
} }
square([shaft_r, height - d_h_unit]); square([radius, height - d_h_unit]);
} }
} }
module peg() { module peg() {
difference() { difference() {
base(shaft_r, lip_r); base(radius, lip_r);
translate([0, 0, d_h_unit]) translate([0, 0, d_h_unit])
linear_extrude(height - r_diff * 2) linear_extrude(height - r_diff * 2)
@@ -28,7 +28,7 @@ module connector_peg(shaft_r = 2.5, spacing = 0.5, void = false, heads = false)
} }
module peg_void() { module peg_void() {
base(shaft_r + spacing, lip_r + spacing); base(radius + spacing, lip_r + spacing);
translate([0, 0, height]) translate([0, 0, height])
linear_extrude(spacing) linear_extrude(spacing)
circle(lip_r); circle(lip_r);