1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-11 17:24:20 +02:00
This commit is contained in:
Justin Lin
2021-06-16 10:17:49 +08:00
parent 88132600fe
commit 89ec4df583

View File

@@ -1,13 +1,15 @@
use <shape_starburst.scad>;
model = "STAR"; // [STAR, BASE, BOTH]
r1 = 12;
r2 = 9.5;
n = 6;
number_of_stars = 10;
number_of_stars = 8;
height = 20;
thickness = 1;
spacing = thickness;
slope = 0.35;
base_height = height * 1.75;
/*
r1 = 12;
@@ -20,9 +22,9 @@ spacing = thickness;
slope = 0.26;
*/
fidget_star(r1, r2, n, number_of_stars, height, thickness, spacing, slope);
fidget_star(model, r1, r2, n, number_of_stars, height, thickness, spacing, slope, base_height);
module fidget_star(r1, r2, n, number_of_stars, height, thickness, spacing, slope) {
module fidget_star(model, r1, r2, n, number_of_stars, height, thickness, spacing, slope, base_height) {
theta = 180 / n;
y = r2 - r2 * cos(theta);
@@ -62,7 +64,69 @@ module fidget_star(r1, r2, n, number_of_stars, height, thickness, spacing, slope
}
}
if(model == "STAR" || model == "BOTH") {
half();
mirror([0, 0, 1])
half();
}
// base
ring_thickness = thickness * 1.5;
module base_ring() {
translate([0, 0, -ring_thickness])
difference() {
linear_extrude(ring_thickness, scale = 1.02)
offset(ring_thickness / 3, $fn = n)
offset(delta = -thickness)
star(rs2[number_of_stars] * s[number_of_stars] * r_ratio, rs2[number_of_stars] * s[number_of_stars]);
//star(rs[n] * s[n] - thickness);
linear_extrude(thickness * 4, center = true)
offset(delta = -ring_thickness)
star(rs2[number_of_stars] * s[number_of_stars] * r_ratio, rs2[number_of_stars] * s[number_of_stars]);
//star(rs[n] * s[n] - ring_thickness);
}
}
if(model == "BASE" || model == "BOTH") {
color("white") {
// plate
translate([0, 0, -half_height])
linear_extrude(half_height, scale = s[number_of_stars])
difference() {
star(rs1[number_of_stars], rs2[number_of_stars]);
offset(delta = -thickness)
star(rs1[number_of_stars], rs2[number_of_stars]);
}
// ring
base_ring();
mirror([0, 0, 1])
base_ring();
translate([0, 0, -base_height + ring_thickness])
mirror([0, 0, 1])
scale([1, 1, 1.5])
base_ring();
// stick
d = rs1[number_of_stars] * s[number_of_stars];
off_h = -base_height + ring_thickness;
a = 180 / n;
stick_r = thickness * 1.75;
stick_h = base_height - ring_thickness;
for(i = [0:n - 1]) {
rotate(360 / n * i)
translate([d, 0, off_h])
rotate(a) {
linear_extrude(stick_h)
circle(stick_r, $fn = n);
translate([0, 0, stick_h])
linear_extrude(ring_thickness, scale = 0.75)
circle(stick_r, $fn = n);
}
}
}
}
}