1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-06 23:06:43 +02:00
This commit is contained in:
Justin Lin
2019-09-26 08:53:47 +08:00
parent ea0fee1148
commit e4ac6dcb98
35 changed files with 500 additions and 456 deletions

View File

@@ -20,10 +20,14 @@ module bearing_captured_in_mobius_cut(ball_radius, mobius_radius, ring_radius, s
circle_points = [for(p = circle_path(ball_track_radius)) p + trans_pt]; circle_points = [for(p = circle_path(ball_track_radius)) p + trans_pt];
difference() { difference() {
rotate_extrude() translate([ring_radius, 0, 0]) circle(mobius_radius); rotate_extrude()
translate([ring_radius, 0, 0])
circle(mobius_radius);
ring_extrude(circle_points, radius = ring_radius, twist = 180); ring_extrude(circle_points, radius = ring_radius, twist = 180);
rotate([180, 0, 0]) rotate([180, 0, 0])
ring_extrude(circle_points, radius = ring_radius, twist = 180); ring_extrude(circle_points, radius = ring_radius, twist = 180);
} }
if(with_ball == "YES") { if(with_ball == "YES") {

View File

@@ -136,68 +136,73 @@ module blocks(points) {
module cactus(w) { module cactus(w) {
linear_extrude(w * 3) { linear_extrude(w * 3) {
translate([2 * w, w * 7]) scale(w) blocks( translate([2 * w, w * 7])
px_polygon([ scale(w)
[0, 2], blocks(
[3, 2], px_polygon([
[5, 4], [0, 2],
[5, 10], [3, 2],
[5, 10], [5, 4],
[3, 10], [5, 10],
[3, 6], [5, 10],
[0, 4], [3, 10],
[3, 6],
[0, 4],
], filled = true) ], filled = true)
); );
translate([-2 * w, w * 5]) scale(w) blocks( translate([-2 * w, w * 5])
px_polygon([ scale(w)
[-1, 0], blocks(
[-3, 0], px_polygon([
[-6, 2], [-1, 0],
[-6, 6], [-3, 0],
[-6, 6], [-6, 2],
[-4, 6], [-6, 6],
[-4, 4], [-6, 6],
[-1, 2], [-4, 6],
[-4, 4],
[-1, 2],
], filled = true) ], filled = true)
); );
scale(w) blocks( scale(w)
px_polygon([ blocks(
[-2, 0], px_polygon([
[2, 0], [-2, 0],
[2, 20], [2, 0],
[1, 22], [2, 20],
[0, 22], [1, 22],
[-1, 22], [0, 22],
[-2, 20] [-1, 22],
], filled = true) [-2, 20]
); ], filled = true)
);
} }
} }
module base(w, base_x_blocks, base_y_blocks) { module base(w, base_x_blocks, base_y_blocks) {
linear_extrude(w) { linear_extrude(w) {
translate([0, -w]) translate([0, -w])
square([base_x_blocks * w, base_y_blocks * w + 2 * w]); square([base_x_blocks * w, base_y_blocks * w + 2 * w]);
translate([0, base_y_blocks * w / 2]) scale(w) blocks(
px_circle(base_y_blocks / 2, filled = true)
);
translate([base_x_blocks * w, base_y_blocks * w / 2]) translate([0, base_y_blocks * w / 2])
scale(w) blocks( scale(w)
px_circle(base_y_blocks / 2, filled = true) blocks(px_circle(base_y_blocks / 2, filled = true));
);
translate([base_x_blocks * w, base_y_blocks * w / 2])
scale(w)
blocks(px_circle(base_y_blocks / 2, filled = true));
} }
} }
module eye(w, eye_spacing) { module eye(w, eye_spacing) {
translate([0, 0, -eye_spacing]) translate([0, 0, -eye_spacing])
rotate([0, -90, 0]) rotate([0, -90, 0])
linear_extrude(w * 5) linear_extrude(w * 5)
offset(delta = -eye_spacing) square(w); offset(delta = -eye_spacing) square(w);
} }
if(part == "DINO") { if(part == "DINO") {
@@ -214,28 +219,35 @@ else if(part == "BASE") {
} }
else if(part == "DEMO") { else if(part == "DEMO") {
wd = 5; wd = 5;
translate([0, wd * 5.5, wd * 5]) rotate([90, 0, 0]) { translate([0, wd * 5.5, wd * 5])
rotate([90, 0, 0]) {
color("DimGray") chrome_dino(wd, true); color("DimGray") chrome_dino(wd, true);
color("white") color("white")
linear_extrude(wd * 5) linear_extrude(wd * 5)
translate([7 * wd, 14 * wd]) square(wd, center = true); translate([7 * wd, 14 * wd]) square(wd, center = true);
} }
color("white") base(wd, 10, 6); color("white") base(wd, 10, 6);
translate([wd * 25, wd * 10, 0]) { translate([wd * 25, wd * 10, 0]) {
translate([wd * 4.25, wd * 4.25, 0]) color("SlateGray") rotate([90, 0, 0]) translate([wd * 4.25, wd * 4.25, 0])
color("SlateGray")
rotate([90, 0, 0])
cactus(wd); cactus(wd);
color("white") base(wd, 10, 6); color("white") base(wd, 10, 6);
} }
translate([-wd * 35, wd * 10, 0]) { translate([-wd * 35, wd * 10, 0]) {
color("SlateGray") { color("SlateGray") {
translate([wd * 4.25, wd * 4, 0]) rotate([90, 0, 0]) translate([wd * 4.25, wd * 4, 0])
mirror([1, 0, 0]) cactus(wd); rotate([90, 0, 0])
mirror([1, 0, 0])
cactus(wd);
scale(0.75) scale(0.75)
translate([wd * 30, wd * 5, 0]) rotate([90, 0, 0]) translate([wd * 30, wd * 5, 0])
cactus(wd); rotate([90, 0, 0])
cactus(wd);
} }
color("white") base(wd, 30, 6); color("white") base(wd, 30, 6);
} }

View File

@@ -14,12 +14,13 @@ module floor_stand(width, height, thickness, spacing) {
module board_base() { module board_base() {
translate([0, -half_h, 0]) translate([0, -half_h, 0])
difference() { difference() {
polygon(points);
translate([0, -half_h, 0])
scale([0.6, 0.1])
polygon(points); polygon(points);
translate([0, -half_h, 0]) }
scale([0.6, 0.1])
polygon(points);
}
} }
module board_U() { module board_U() {
@@ -27,13 +28,13 @@ module floor_stand(width, height, thickness, spacing) {
difference() { difference() {
union() { union() {
linear_extrude(thickness, center = true) linear_extrude(thickness, center = true)
difference() { difference() {
board_base(); board_base();
square([width / 1.5, height / 3], center = true); square([width / 1.5, height / 3], center = true);
} }
rotate(angles) rotate(angles)
linear_extrude(width / 2.25 * 2, center = true) linear_extrude(width / 2.25 * 2, center = true)
circle(half_th); circle(half_th);
} }
rotate(angles) { rotate(angles) {
@@ -52,11 +53,12 @@ module floor_stand(width, height, thickness, spacing) {
board_base(); board_base();
square([width, height / 3], center = true); square([width, height / 3], center = true);
} }
translate([0, -height / 12 - spacing / 2, 0]) translate([0, -height / 12 - spacing / 2, 0])
difference() { difference() {
square([width / 1.5 - double_spacing, height / 6 + spacing], center = true); square([width / 1.5 - double_spacing, height / 6 + spacing], center = true);
square([width / 1.5 - thickness * 2, height / 6], center = true); square([width / 1.5 - thickness * 2, height / 6], center = true);
} }
} }
rotate([0, 90, 0]) { rotate([0, 90, 0]) {
@@ -68,11 +70,12 @@ module floor_stand(width, height, thickness, spacing) {
module border() { module border() {
translate([0, 0, half_th]) translate([0, 0, half_th])
color("black") linear_extrude(half_th / 2) color("black")
hollow_out(shell_thickness = font_size / 4) linear_extrude(half_th / 2)
offset(half_w / 10) hollow_out(shell_thickness = font_size / 4)
scale([0.75, 0.675]) offset(half_w / 10)
polygon(points); scale([0.75, 0.675])
polygon(points);
} }
module stick() { module stick() {
@@ -82,36 +85,35 @@ module floor_stand(width, height, thickness, spacing) {
module decorate() { module decorate() {
rotate([-80, 0, 0]) rotate([-80, 0, 0])
difference() {
rotate([80, 0, 0])
difference() { difference() {
rotate([80, 0, 0]) union() {
difference() { color("yellow") children();
union() { translate([0, -height / 1.8, 0]) border();
color("yellow") children(); }
translate([0, -height / 1.8, 0]) // slot
border(); translate([0, -half_h - thickness, -half_th])
} stick();
// slot
translate([0, -half_h - thickness, -half_th])
stick();
}
translate([0, 0, -height - half_th])
linear_extrude(thickness)
square(width, center = true);
} }
translate([0, 0, -height - half_th])
linear_extrude(thickness)
square(width, center = true);
}
} }
// stick // stick
translate([width, 0, 0]) translate([width, 0, 0])
stick(); stick();
translate([0, 0, half_th]) translate([0, 0, half_th])
decorate() decorate()
board_U(); board_U();
translate([0, 0, half_th]) translate([0, 0, half_th])
rotate(180) rotate(180)
decorate() decorate()
board_T(); board_T();
children(0); children(0);
if($children == 1) { if($children == 1) {

View File

@@ -20,16 +20,16 @@ module words(text, font, font_size, height, thickness, line_spacing) {
color("black") color("black")
translate([0, -height / 1.8, thickness]) translate([0, -height / 1.8, thickness])
linear_extrude(half_th / 2) { linear_extrude(half_th / 2) {
multi_line_text( multi_line_text(
split_str(text, " "), split_str(text, " "),
font = font, font = font,
size = font_size, size = font_size,
line_spacing = line_spacing, line_spacing = line_spacing,
valign = "center", valign = "center",
halign = "center" halign = "center"
); );
} }
} }
floor_stand(stand_width, stand_height, stand_thickness, stand_spacing) floor_stand(stand_width, stand_height, stand_thickness, stand_spacing)

View File

@@ -10,11 +10,11 @@ module heart(radius, center = false) {
module heart_sub_component() { module heart_sub_component() {
translate([-radius * cos(rotated_angle), 0, 0]) translate([-radius * cos(rotated_angle), 0, 0])
rotate(-rotated_angle) union() { rotate(-rotated_angle) union() {
circle(radius); circle(radius);
translate([0, -radius, 0]) translate([0, -radius, 0])
square(diameter); square(diameter);
} }
} }
offsetX = center ? 0 : radius + radius * cos(45); offsetX = center ? 0 : radius + radius * cos(45);
@@ -33,8 +33,8 @@ module heart_with_ears(heart_width, thickness, spacing) {
arc(radius, [0, 240], width, "LINE_OUTWARD"); arc(radius, [0, 240], width, "LINE_OUTWARD");
translate([0, 0, thickness + spacing]) translate([0, 0, thickness + spacing])
linear_extrude(thickness) linear_extrude(thickness)
arc(radius, [240, 360], width, "LINE_OUTWARD"); arc(radius, [240, 360], width, "LINE_OUTWARD");
linear_extrude(thickness * 2 + spacing) linear_extrude(thickness * 2 + spacing)
arc(radius, [0, 20], width, "LINE_OUTWARD"); arc(radius, [0, 20], width, "LINE_OUTWARD");
@@ -50,12 +50,12 @@ module heart_with_ears(heart_width, thickness, spacing) {
heart(heart_radius, center = true); heart(heart_radius, center = true);
translate([ring_x, ring_y, 0]) translate([ring_x, ring_y, 0])
rotate(-40) rotate(-40)
ear(ring_radius, ring_thickness, spacing); ear(ring_radius, ring_thickness, spacing);
translate([-ring_x, ring_y, 0]) translate([-ring_x, ring_y, 0])
rotate(125) rotate(125)
ear(ring_radius, ring_thickness, spacing); ear(ring_radius, ring_thickness, spacing);
} }
module text_heart(char, width, thickness, spacing) { module text_heart(char, width, thickness, spacing) {
@@ -64,13 +64,13 @@ module text_heart(char, width, thickness, spacing) {
difference() { difference() {
heart_with_ears(width, thickness, spacing); heart_with_ears(width, thickness, spacing);
translate([0, 0, half_thickness]) translate([0, 0, half_thickness])
linear_extrude(half_thickness) linear_extrude(half_thickness)
offset(-half_thickness) offset(-half_thickness)
heart(radius, center = true); heart(radius, center = true);
} }
translate([0, radius / 4, half_thickness]) translate([0, radius / 4, half_thickness])
linear_extrude(half_thickness) linear_extrude(half_thickness)
text(char, font = "Arial Black", size = radius * 1.2, valign = "center", halign="center"); text(char, font = "Arial Black", size = radius * 1.2, valign = "center", halign="center");
} }
module heart_chain(chars) { module heart_chain(chars) {
@@ -91,8 +91,8 @@ module heart_chain(chars) {
pt = points_angles[i][0]; pt = points_angles[i][0];
angle = points_angles[i][1]; angle = points_angles[i][1];
translate(pt) translate(pt)
rotate(angle + 90) rotate(angle + 90)
text_heart(chars[i], heart_width, heart_thickness, spacing); text_heart(chars[i], heart_width, heart_thickness, spacing);
} }
} }

View File

@@ -19,8 +19,8 @@ module hypnotic_squares(x_grids, y_grids, grid_size, final_size, line_width) {
module hollow_square(x, y, size) { module hollow_square(x, y, size) {
translate([x - half_lw, y - half_lw]) translate([x - half_lw, y - half_lw])
hollow_out(line_width) hollow_out(line_width)
square(size + line_width); square(size + line_width);
} }
module draw(x, y, size, xMovement, yMovement, steps) { module draw(x, y, size, xMovement, yMovement, steps) {

View File

@@ -17,11 +17,11 @@ cut = false; // [true,false]
module klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) { module klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) {
$fn = fn; $fn = fn;
half_thickness = thickness / 2;
module bottom() { module bottom() {
rotate(180) rotate_extrude() { rotate(180)
rotate_extrude() {
translate([radius1 + radius2, 0, 0]) translate([radius1 + radius2, 0, 0])
polyline2d( polyline2d(
arc_path(radius = radius2, angle = [180, 360]) arc_path(radius = radius2, angle = [180, 360])
@@ -54,7 +54,7 @@ module klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) {
[0, radius1 * 4, bottom_height], [0, radius1 * 4, bottom_height],
[0, radius1 * 3, bottom_height - radius1], [0, radius1 * 3, bottom_height - radius1],
[0, radius1 * 2, bottom_height - radius1 * 2], [0, radius1 * 2, bottom_height - radius1 * 2],
[0, radius1, bottom_height + thickness / 2 - radius1 * 3], [0, radius1, bottom_height + half_thickness - radius1 * 3],
[0, 0, bottom_height - radius1 * 4], [0, 0, bottom_height - radius1 * 4],
[0, 0, bottom_height - radius1 * 5] [0, 0, bottom_height - radius1 * 5]
]; ];
@@ -80,13 +80,13 @@ module klein_bottle(radius1, radius2, bottom_height, thickness, t_step, fn) {
bottom(); bottom();
path_extrude( path_extrude(
circle_path(radius1 + thickness / 2), circle_path(radius1 + half_thickness),
tube_path tube_path
); );
} }
path_extrude( path_extrude(
circle_path(radius1 - thickness / 2), circle_path(radius1 - half_thickness),
tube_path2 tube_path2
); );
} }

View File

@@ -24,11 +24,12 @@ module build_ramp_maze(rows, columns, blocks, block_width, wall_thickness, wall_
hull() { hull() {
translate(point1) translate(point1)
linear_extrude(height, scale = top_scale) linear_extrude(height, scale = top_scale)
square(width, center = true); square(width, center = true);
translate(point2) translate(point2)
linear_extrude(height, scale = top_scale) linear_extrude(height, scale = top_scale)
square(width, center = true); square(width, center = true);
} }
} }

View File

@@ -23,13 +23,14 @@ module pyramid_maze(maze_rows, block_width, wall_thickness) {
intersection() { intersection() {
linear_extrude(leng * 2) linear_extrude(leng * 2)
translate([-half_leng, -half_leng]) build_square_maze( translate([-half_leng, -half_leng]) build_square_maze(
maze_rows, maze_rows,
maze_rows, maze_rows,
maze_blocks, maze_blocks,
block_width, block_width,
wall_thickness wall_thickness
); );
pyramid(leng + wall_thickness); pyramid(leng + wall_thickness);
} }
} }

View File

@@ -20,8 +20,8 @@ module pyramid_with_stairs(base_width, stairs_width, rows) {
for(j = [1:stairsteps]) { for(j = [1:stairsteps]) {
square_w = base_w - j * staircase_w; square_w = base_w - j * staircase_w;
translate([0, 0, staircase_h * (j - 1)]) translate([0, 0, staircase_h * (j - 1)])
linear_extrude(staircase_h) linear_extrude(staircase_h)
square([square_w, square_w], center = true); square([square_w, square_w], center = true);
} }
} }
@@ -46,23 +46,23 @@ module step_pyramid_maze(maze_rows, block_width, stairs_width) {
square([block_width * maze_rows + stairs_width, block_width * maze_rows + stairs_width], center = true); square([block_width * maze_rows + stairs_width, block_width * maze_rows + stairs_width], center = true);
translate([-(maze_rows * block_width) / 2, -(maze_rows * block_width) / 2, 0]) translate([-(maze_rows * block_width) / 2, -(maze_rows * block_width) / 2, 0])
difference() { difference() {
build_square_maze( build_square_maze(
maze_rows, maze_rows,
maze_rows, maze_rows,
maze_blocks, maze_blocks,
block_width, block_width,
stairs_width stairs_width
); );
// entry // entry
translate([0, stairs_width]) translate([0, stairs_width])
square(stairs_width, center = true); square(stairs_width, center = true);
// exit // exit
translate([maze_rows * block_width, maze_rows * block_width - stairs_width]) translate([maze_rows * block_width, maze_rows * block_width - stairs_width])
square(stairs_width, center = true); square(stairs_width, center = true);
} }
} }
} }
} }

View File

@@ -27,14 +27,14 @@ module hex_maze_stereographic_projection(x_cells, cell_radius, wall_thickness, f
maze_vector = go_maze(1, 1, starting_maze(y_cells, x_cells), y_cells, x_cells); maze_vector = go_maze(1, 1, starting_maze(y_cells, x_cells), y_cells, x_cells);
stereographic_extrude(square_w, $fn = fn) stereographic_extrude(square_w, $fn = fn)
translate([grid_w - square_w / 2, grid_h - square_w / 2, 0]) translate([grid_w - square_w / 2, grid_h - square_w / 2, 0])
build_hex_maze(y_cells, x_cells, maze_vector, cell_radius, wall_thickness); build_hex_maze(y_cells, x_cells, maze_vector, cell_radius, wall_thickness);
if(shadow == "YES") { if(shadow == "YES") {
color("black") color("black")
linear_extrude(wall_height) linear_extrude(wall_height)
translate([grid_w - square_w / 2, grid_h - square_w / 2, 0]) translate([grid_w - square_w / 2, grid_h - square_w / 2, 0])
build_hex_maze(y_cells, x_cells, maze_vector, cell_radius, wall_thickness); build_hex_maze(y_cells, x_cells, maze_vector, cell_radius, wall_thickness);
} }
} }

View File

@@ -34,8 +34,8 @@ module stereographic_projection_maze2(maze_rows, block_width, wall_thickness, fn
if(shadow == "YES") { if(shadow == "YES") {
color("black") color("black")
linear_extrude(wall_height) linear_extrude(wall_height)
maze(); maze();
} }
} }

View File

@@ -23,7 +23,8 @@ module clock(r, thickness, hour, minute) {
line2d([0, 0], [0, r - thickness * 3], thickness * 0.75, p1Style = "CAP_ROUND", p2Style = "CAP_ROUND", $fn = 4); line2d([0, 0], [0, r - thickness * 3], thickness * 0.75, p1Style = "CAP_ROUND", p2Style = "CAP_ROUND", $fn = 4);
for(i = [0: 11]) { for(i = [0: 11]) {
rotate(i * 30) translate([0, r - thickness * 4, 0]) rotate(i * 30)
translate([0, r - thickness * 4, 0])
square([thickness / 2, thickness * 2]); square([thickness / 2, thickness * 2]);
} }
} }
@@ -34,12 +35,12 @@ module melt(r, thickness, angle, frags, xscale = 1) {
rz = r * 180 / (angle * 3.14159); rz = r * 180 / (angle * 3.14159);
mirror([0, 1, 0]) mirror([0, 1, 0])
scale([xscale, 1, 1]) scale([xscale, 1, 1])
translate([0, r, rz]) translate([0, r, rz])
rotate([0, 90, -90]) rotate([0, 90, -90])
bend_extrude([r, double_r], thickness, angle, frags) bend_extrude([r, double_r], thickness, angle, frags)
translate([0, r, 0]) translate([0, r, 0])
children(); children();
linear_extrude(thickness) linear_extrude(thickness)
intersection() { intersection() {
@@ -55,15 +56,16 @@ module melted_clock() {
$fn = 48; $fn = 48;
sa = r * angle / (r + thickness); sa = r * angle / (r + thickness);
rotate([0, 180, 0]) rotate([0, 180, 0])
mirror([1, 0, 0]) { mirror([1, 0, 0]) {
color("Gold") color("Gold")
translate([0, 0, thickness]) translate([0, 0, thickness])
melt(r, thickness, angle, frags, xscale) circle(r); melt(r, thickness, angle, frags, xscale)
circle(r);
color("Gainsboro") melt(r, thickness, sa, frags, xscale) color("Gainsboro")
melt(r, thickness, sa, frags, xscale)
clock(r - thickness * 2, thickness, hour, minute); clock(r - thickness * 2, thickness, hour, minute);
; }
}
} }
melted_clock(); melted_clock();

View File

@@ -54,9 +54,8 @@ module puzzle_piece_with_text(side_length, text, spacing) {
difference() { difference() {
puzzle_piece(side_length, spacing); puzzle_piece(side_length, spacing);
translate([half_side_length, half_side_length]) translate([half_side_length, half_side_length])
rotate(-45) rotate(-45)
text(text, size = side_length / 3, text(text, size = side_length / 3, halign = "center", valign = "center");
halign = "center", valign = "center");
} }
} }
@@ -95,8 +94,8 @@ module multiplication_puzzle(n, piece_side_length, spacing) {
} }
} }
linear_extrude(r - 0.6) linear_extrude(r - 0.6)
translate(pos) translate(pos)
puzzle_piece(piece_side_length, spacing); puzzle_piece(piece_side_length, spacing);
} }
} }

View File

@@ -52,13 +52,15 @@ function packing_circles(size, min_radius, max_radius, total_circles, attempts =
circles = packing_circles(size, min_radius, max_radius, total_circles); circles = packing_circles(size, min_radius, max_radius, total_circles);
mr = max([for(c = circles) c[2]]); mr = max([for(c = circles) c[2]]);
translate([0, 0, mr]) for(c = circles) { translate([0, 0, mr])
translate([c[0], c[1]]) for(c = circles) {
sphere(c[2], $fn = 48); translate([c[0], c[1]])
} sphere(c[2], $fn = 48);
}
for(c = circles) { for(c = circles) {
translate([c[0], c[1]]) translate([c[0], c[1]])
linear_extrude(mr) linear_extrude(mr)
circle(c[2]/ 3, $fn = 48); circle(c[2]/ 3, $fn = 48);
} }
linear_extrude(1) square(size); linear_extrude(1) square(size);

View File

@@ -23,20 +23,18 @@ module pixel_vase(x1, x2, x3, thickness) {
leng = len(px_path); leng = len(px_path);
for(p = px_cylinder(px_path[0][0], 1, true)) { for(p = px_cylinder(px_path[0][0], 1, true)) {
linear_extrude(1) union() { linear_extrude(1)
translate([p[0], p[1]]) translate([p[0], p[1]])
square(1.1, center = true); square(1.1, center = true);
}
} }
for(i = [0:leng - 1]) { for(i = [0:leng - 1]) {
r = px_path[i][0]; r = px_path[i][0];
for(p = px_cylinder(r, 1, thickness = thickness)) { for(p = px_cylinder(r, 1, thickness = thickness)) {
translate([0, 0, i]) translate([0, 0, i])
linear_extrude(1) union() { linear_extrude(1)
translate([p[0], p[1]]) translate([p[0], p[1]])
square(1.1, center = true); square(1.1, center = true);
}
} }
} }
} }

View File

@@ -7,7 +7,8 @@ tx = "3.141592653589793238462643383279502884197169399375105820974944592307816406
pts = [for(p = px_spiral(1, floor(sqrt(len(tx))) + 1)) p * 8]; pts = [for(p = px_spiral(1, floor(sqrt(len(tx))) + 1)) p * 8];
linear_extrude(2) linear_extrude(2)
for(i = [0:len(tx) - 1]) { for(i = [0:len(tx) - 1]) {
translate(pts[i]) difference() { translate(pts[i])
difference() {
square(7, center = true); square(7, center = true);
render() for(p = px_ascii(tx[i], center = true)) { render() for(p = px_ascii(tx[i], center = true)) {
translate(p) square(.8); translate(p) square(.8);

View File

@@ -16,9 +16,10 @@ qr_coder();
module qr_coder() { module qr_coder() {
color("black") color("black")
rotate([0, 180, 0]) rotate([0, 180, 0])
translate([0, 0, -qr_thickness - head_size]) translate([0, 0, -qr_thickness - head_size])
linear_extrude(qr_thickness) linear_extrude(qr_thickness)
mirror([1, 0, 0]) qrcode(t, head_size * 0.9, encoding, min_error_correction_level, mask, center = true); mirror([1, 0, 0])
qrcode(t, head_size * 0.9, encoding, min_error_correction_level, mask, center = true);
cube_character(head_size); cube_character(head_size);
} }
@@ -33,8 +34,8 @@ module cube_character(head_size) {
square(head_size, center = true); square(head_size, center = true);
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(peg_radius, spacing = spacing, void = true); connector_peg(peg_radius, spacing = spacing, void = true);
} }
} }
@@ -44,25 +45,26 @@ 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(peg_radius, spacing = spacing, void = true); connector_peg(peg_radius, spacing = spacing, void = true);
} }
difference() { difference() {
linear_extrude(body_size) union() { linear_extrude(body_size)
union() {
square(body_size, center = true); square(body_size, center = true);
// feet // feet
translate([0, -head_size * 0.4, 0]) translate([0, -head_size * 0.4, 0])
difference() { difference() {
square(head_size * 0.65, center = true); square(head_size * 0.65, center = true);
square([head_size * 0.05, head_size * 0.65], center = true); square([head_size * 0.05, head_size * 0.65], center = true);
} }
} }
// 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(peg_radius, spacing = spacing, void = true); connector_peg(peg_radius, spacing = spacing, void = true);
peg_void(); peg_void();
mirror([1, 0, 0]) peg_void(); mirror([1, 0, 0]) peg_void();
@@ -80,8 +82,8 @@ module cube_character(head_size) {
square(hand_size, center = true); square(hand_size, center = true);
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(peg_radius, spacing = spacing); connector_peg(peg_radius, spacing = spacing);
} }
} }

View File

@@ -54,21 +54,24 @@ module dog_back(head_r, peg_radius) {
$fn = 36; $fn = 36;
module foot() { module foot() {
translate([head_r, 0, 0]) union() { translate([head_r, 0, 0])
union() {
color("PapayaWhip") color("PapayaWhip")
ellipse_extrude(head_r / 3) polygon( ellipse_extrude(head_r / 3)
shape_ellipse([head_r / 3, head_r / 2]) polygon(shape_ellipse([head_r / 3, head_r / 2]));
);
color("Maroon") color("Maroon")
linear_extrude(head_r) circle(head_r / 8); linear_extrude(head_r)
circle(head_r / 8);
color("Goldenrod") translate([head_r / 45, 0, head_r / 2]) color("Goldenrod")
rotate([0, -15, 0]) rounded_cylinder( translate([head_r / 45, 0, head_r / 2])
radius = [head_r / 5, head_r / 3.5], rotate([0, -15, 0])
h = head_r * 1.25, rounded_cylinder(
round_r = 2 radius = [head_r / 5, head_r / 3.5],
); h = head_r * 1.25,
round_r = 2
);
} }
} }
@@ -96,16 +99,17 @@ module dog_back(head_r, peg_radius) {
body_feet(); body_feet();
rotate([-36.5, 0, 0]) rotate([-36.5, 0, 0])
color("Goldenrod") color("Goldenrod")
linear_extrude(head_r * 2, scale = 0.5) linear_extrude(head_r * 2, scale = 0.5)
circle(head_r / 6); circle(head_r / 6);
} }
back(); back();
color("Goldenrod") translate([0, -head_r * 0.2, 0]) color("Goldenrod")
rotate([90, 0, 0]) translate([0, -head_r * 0.2, 0])
connector_peg(peg_radius, spacing = spacing); rotate([90, 0, 0])
connector_peg(peg_radius, spacing = spacing);
} }
module spring_dog_spring(head_r, spring_levels, line_thickness, line_distance, peg_radius, plate_h, spacing) { module spring_dog_spring(head_r, spring_levels, line_thickness, line_distance, peg_radius, plate_h, spacing) {
@@ -150,45 +154,44 @@ module dog_front(head_r, peg_radius, spacing) {
module head() { module head() {
module head_nose() { module head_nose() {
color("Goldenrod") color("Goldenrod")
rotate([-15, 0, 0]) rotate([-15, 0, 0])
scale([1, 0.9, 0.9]) scale([1, 0.9, 0.9])
sphere(head_r); sphere(head_r);
// nose // nose
color("PapayaWhip") color("PapayaWhip")
translate([0, -head_r * 0.45, -head_r / 5]) translate([0, -head_r * 0.45, -head_r / 5])
rotate([85, 0, 0]) rotate([85, 0, 0])
scale([1.25, 0.8, 1]) scale([1.25, 0.8, 1])
rounded_cylinder( rounded_cylinder(
radius = [head_r / 2, head_r / 6], radius = [head_r / 2, head_r / 6],
h = head_r * 1.25, h = head_r * 1.25,
round_r = 4 round_r = 4
); );
color("black") color("black")
translate([0, -head_r * 1.6, 0]) translate([0, -head_r * 1.6, 0])
rotate([15, 0, 0]) rotate([15, 0, 0])
scale([1.25, 1, 1]) scale([1.25, 1, 1])
sphere(head_r / 7); sphere(head_r / 7);
} }
module eye() { module eye() {
translate([head_r / 2, -head_r / 1.75, head_r / 3]) translate([head_r / 2, -head_r / 1.75, head_r / 3])
rotate([-20, 5, 30]) rotate([-20, 5, 30])
scale([1.2, 0.5, 1]) { scale([1.2, 0.5, 1]) {
color("Goldenrod") color("Goldenrod") sphere(head_r / 3);
sphere(head_r / 3);
color("white") color("white")
translate([0, 0, -head_r / 15]) translate([0, 0, -head_r / 15])
rotate([-25, -10, 0]) rotate([-25, -10, 0])
scale([1.1, 1.25, 1.2]) scale([1.1, 1.25, 1.2])
sphere(head_r / 3.5); sphere(head_r / 3.5);
color("black") color("black")
translate([-head_r / 15, -head_r / 4, -head_r / 12]) translate([-head_r / 15, -head_r / 4, -head_r / 12])
sphere(head_r / 7); sphere(head_r / 7);
} }
} }
module eyes() { module eyes() {
@@ -199,9 +202,9 @@ module dog_front(head_r, peg_radius, spacing) {
module eyebrow() { module eyebrow() {
color("black") color("black")
translate([head_r / 2.5, -head_r / 2.5, head_r / 3]) translate([head_r / 2.5, -head_r / 2.5, head_r / 3])
rotate([60, 15, 30]) rotate([60, 15, 30])
linear_extrude(head_r / 2, center = true) scale([1.5, 1, 1]) linear_extrude(head_r / 2, center = true) scale([1.5, 1, 1])
arc(radius = head_r / 3, angle = 120, width = head_r / 20); arc(radius = head_r / 3, angle = 120, width = head_r / 20);
} }
@@ -215,18 +218,18 @@ module dog_front(head_r, peg_radius, spacing) {
module ear() { module ear() {
color("Maroon") color("Maroon")
rotate([-15, 0, -10]) rotate([-15, 0, -10])
translate([-head_r / 2.75, head_r / 15, -head_r / 2.75]) translate([-head_r / 2.75, head_r / 15, -head_r / 2.75])
rotate([0, -60, 0]) rotate([0, -60, 0])
scale([1.25, 1, 1]) intersection() { scale([1.25, 1, 1]) intersection() {
translate([head_r, 0, 0]) translate([head_r, 0, 0])
linear_extrude(head_r) linear_extrude(head_r)
polygon(shape_pts); polygon(shape_pts);
difference() { difference() {
sphere(head_r); sphere(head_r);
sphere(head_r - head_r / 10); sphere(head_r - head_r / 10);
} }
} }
} }
module ears() { module ears() {
@@ -242,21 +245,25 @@ module dog_front(head_r, peg_radius, spacing) {
module foot() { module foot() {
translate([head_r, -head_r / 11, 0]) union() { translate([head_r, -head_r / 11, 0]) {
color("PapayaWhip") color("PapayaWhip")
ellipse_extrude(head_r / 3) polygon( ellipse_extrude(head_r / 3)
shape_ellipse([head_r / 3, head_r / 2]) polygon(
); shape_ellipse([head_r / 3, head_r / 2])
);
color("Maroon") color("Maroon")
linear_extrude(head_r) circle(head_r / 8); linear_extrude(head_r)
circle(head_r / 8);
color("Goldenrod") color("Goldenrod")
translate([head_r / 45, 0, head_r / 2]) rotate([0, -15, 0]) rounded_cylinder( translate([head_r / 45, 0, head_r / 2])
radius = [head_r / 5, head_r / 3.5], rotate([0, -15, 0])
h = head_r * 1.25, rounded_cylinder(
round_r = 2 radius = [head_r / 5, head_r / 3.5],
); h = head_r * 1.25,
round_r = 2
);
} }
} }
@@ -271,7 +278,8 @@ module dog_front(head_r, peg_radius, spacing) {
feet(); feet();
color("Goldenrod") color("Goldenrod")
scale([1, 1.25, 1]) difference() { scale([1, 1.25, 1])
difference() {
sphere(head_r); sphere(head_r);
translate([-head_r, head_r / 6, -head_r]) translate([-head_r, head_r / 6, -head_r])
@@ -290,10 +298,10 @@ module dog_front(head_r, peg_radius, spacing) {
color("green") color("green")
translate([0, 0, head_r * 1.1]) translate([0, 0, head_r * 1.1])
rotate([-10, 0, 0]) rotate([-10, 0, 0])
rotate_extrude() rotate_extrude()
translate([head_r / 4, 0, 0]) translate([head_r / 4, 0, 0])
circle(head_r / 10); circle(head_r / 10);
} }
} }

View File

@@ -39,8 +39,8 @@ module stick_square(inner_square_leng, stick_leng, stick_thickness, cap_style) {
sticks(); sticks();
translate([0, 0, stick_thickness]) translate([0, 0, stick_thickness])
rotate(90) rotate(90)
sticks(); sticks();
} }
module spiral_stack(orig_leng, orig_height, current_leng, leng_diff, min_leng, angle_offset, pre_height = 0, i = 0) { module spiral_stack(orig_leng, orig_height, current_leng, leng_diff, min_leng, angle_offset, pre_height = 0, i = 0) {
@@ -50,8 +50,8 @@ module spiral_stack(orig_leng, orig_height, current_leng, leng_diff, min_leng, a
factor = current_leng / orig_leng; factor = current_leng / orig_leng;
translate([0, 0, pre_height]) translate([0, 0, pre_height])
scale(factor) scale(factor)
children(); children();
next_square_leng = sqrt(pow(leng_diff, 2) + pow(current_leng - leng_diff, 2)); next_square_leng = sqrt(pow(leng_diff, 2) + pow(current_leng - leng_diff, 2));

View File

@@ -61,22 +61,22 @@ module base(leng, thickness, line_fn) {
sphere(r, $fn = 48); sphere(r, $fn = 48);
translate([0, 0, -r]) translate([0, 0, -r])
linear_extrude(r) linear_extrude(r)
square(r * 2, center = true); square(r * 2, center = true);
translate([0, 0, height(leng) + half_th]) translate([0, 0, height(leng) + half_th])
rotate([0, 180, 0]) rotate([0, 180, 0])
translate([0, -leng / 2 * tan(30), 0]) translate([0, -leng / 2 * tan(30), 0])
hull() { hull() {
translate(vts[0]) translate(vts[0])
sphere(half_th, $fn = line_fn); sphere(half_th, $fn = line_fn);
translate(vts[1]) translate(vts[1])
sphere(half_th, $fn = line_fn); sphere(half_th, $fn = line_fn);
translate(vts[2]) translate(vts[2])
sphere(half_th, $fn = line_fn); sphere(half_th, $fn = line_fn);
translate(vts[3]) translate(vts[3])
sphere(half_th, $fn = line_fn); sphere(half_th, $fn = line_fn);
} }
} }
} }
@@ -86,9 +86,10 @@ if(model == "Tetrahedron") {
base(leng, thickness, line_fn); base(leng, thickness, line_fn);
} else { } else {
translate([0, 0, height(leng) + half_th]) translate([0, 0, height(leng) + half_th])
rotate([0, 180, 0]) rotate([0, 180, 0])
translate([0, -leng / 2 * tan(30), 0]) translate([0, -leng / 2 * tan(30), 0])
string_tetrahedron(leng, thickness, segs_per_side, line_fn); string_tetrahedron(leng, thickness, segs_per_side, line_fn);
base(leng, thickness, line_fn); base(leng, thickness, line_fn);
} }

View File

@@ -64,8 +64,8 @@ module superformula_vase(phi_step, m, n, n3, d, r1, r2, h1, h2, t_step, twist) {
} }
linear_extrude(d) linear_extrude(d)
rotate(twist - twist / len(sections)) rotate(twist - twist / len(sections))
polygon(superformula2); polygon(superformula2);
} }
superformula_vase(phi_step, m, n, n3, d, r1, r2, h1, h2, t_step, twist); superformula_vase(phi_step, m, n, n3, d, r1, r2, h1, h2, t_step, twist);

View File

@@ -32,8 +32,9 @@ module cargo_container_landmark() {
module cargoL1() { module cargoL1() {
translate([cargo_height, 0, -cargo20ft_len]) translate([cargo_height, 0, -cargo20ft_len])
rotate([0, -90, 0]) rotate([0, -90, 0])
cargo20ft(); cargo20ft();
cargo40ft(); cargo40ft();
} }
@@ -41,8 +42,9 @@ module cargo_container_landmark() {
translate([-40, -10, 38.75]) translate([-40, -10, 38.75])
rotate([18.315, 17.75, 0]) { rotate([18.315, 17.75, 0]) {
translate([cargo40ft_len + cargo_width, cargo_width - cargo20ft_len, 0]) translate([cargo40ft_len + cargo_width, cargo_width - cargo20ft_len, 0])
rotate(90) rotate(90)
cargo20ft(); cargo20ft();
translate([cargo20ft_len + cargo_width, -cargo20ft_len, 0]) translate([cargo20ft_len + cargo_width, -cargo20ft_len, 0])
cargo20ft(); cargo20ft();
@@ -52,21 +54,22 @@ module cargo_container_landmark() {
translate([cargo_width, cargo20ft_len, -cargo20ft_len]) { translate([cargo_width, cargo20ft_len, -cargo20ft_len]) {
translate([cargo20ft_len, 0, cargo_height]) translate([cargo20ft_len, 0, cargo_height])
rotate([0, -90, 0]) rotate([0, -90, 0])
cargo40ft(); cargo40ft();
cargo20ft(); cargo20ft();
} }
cargoL1(); cargoL1();
translate([cargo_width, cargo_width, -cargo20ft_len]) translate([cargo_width, cargo_width, -cargo20ft_len])
rotate([0, 0, 90]) rotate([0, 0, 90])
cargo20ft(); cargo20ft();
} }
if(platform == "YES") { if(platform == "YES") {
color("black") color("black")
box_extrude(height = 2, shell_thickness = 1) box_extrude(height = 2, shell_thickness = 1)
circle(75, $fn = 96); circle(75, $fn = 96);
} }
} }
@@ -86,10 +89,11 @@ module cargo_container(leng, width, height) {
step_x = leng / nums; step_x = leng / nums;
half_step_x = step_x * 0.5; half_step_x = step_x * 0.5;
points = [for(i = [0:nums - 1]) [-half_leng + i * step_x + half_step_x, 0]]; points = [for(i = [0:nums - 1]) [-half_leng + i * step_x + half_step_x, 0]];
along_with(points) along_with(points)
rotate([-90, 90, 0]) rotate([-90, 90, 0])
linear_extrude(thickness, scale = [0.7, 0.9], center = true) linear_extrude(thickness, scale = [0.7, 0.9], center = true)
square([half_step_x, height - edge], center = true); square([half_step_x, height - edge], center = true);
} }
module door() { module door() {
@@ -99,8 +103,8 @@ module cargo_container(leng, width, height) {
for(i = [-1:1]) { for(i = [-1:1]) {
translate([-height / 4.25 * i, 0, z]) translate([-height / 4.25 * i, 0, z])
linear_extrude(h, scale = 0.95) linear_extrude(h, scale = 0.95)
square(size, center = true); square(size, center = true);
} }
} }
} }
@@ -112,8 +116,8 @@ module cargo_container(leng, width, height) {
module side() { module side() {
translate([half_leng, half_w - half_thickness + d_offset, half_h]) translate([half_leng, half_w - half_thickness + d_offset, half_h])
rotate([90, 0, 0]) rotate([90, 0, 0])
railing(rails, leng, thickness); railing(rails, leng, thickness);
} }
@@ -125,9 +129,9 @@ module cargo_container(leng, width, height) {
union() { union() {
// front // front
translate([-d_offset, 0, half_h]) translate([-d_offset, 0, half_h])
rotate([0, 90, 0]) rotate([0, 90, 0])
linear_extrude(thickness, scale = 0.95) linear_extrude(thickness, scale = 0.95)
square([height * 0.95, width * 0.95], center = true); square([height * 0.95, width * 0.95], center = true);
// back // back
translate([leng - half_thickness + d_offset, 0, half_h]) translate([leng - half_thickness + d_offset, 0, half_h])
@@ -136,9 +140,9 @@ module cargo_container(leng, width, height) {
// top // top
translate([half_leng, 0, height - half_thickness + d_offset]) translate([half_leng, 0, height - half_thickness + d_offset])
rotate([180, 0, 0]) rotate([180, 0, 0])
scale([1, (width - edge) / height, 1]) scale([1, (width - edge) / height, 1])
railing(rails, leng, thickness); railing(rails, leng, thickness);
side(); side();
mirror([0, 1, 0]) mirror([0, 1, 0])
@@ -147,8 +151,8 @@ module cargo_container(leng, width, height) {
// bottom // bottom
translate([half_leng, half_w, -height / 400]) translate([half_leng, half_w, -height / 400])
linear_extrude(height / 80, scale = 0.95) linear_extrude(height / 80, scale = 0.95)
square([leng * 0.975, width * 0.9], center = true); square([leng * 0.975, width * 0.9], center = true);
} }
translate([0, 0, half_h]) translate([0, 0, half_h])

View File

@@ -59,9 +59,9 @@ module dancing_formosan(x1, x2, x3, y1, y2, y3, twist, t_step) {
} }
translate([0, 0, -2]) translate([0, 0, -2])
linear_extrude(2) linear_extrude(2)
rotate(twist - twist / len(sections)) rotate(twist - twist / len(sections))
polygon(taiwan); polygon(taiwan);
} }

View File

@@ -135,8 +135,9 @@ levels = [
dots = px_gray(levels, center = true, invert = true, normalize = true); dots = px_gray(levels, center = true, invert = true, normalize = true);
linear_extrude(1.5) difference() { linear_extrude(1.5) difference() {
translate([6.5, -10]) translate([6.5, -10])
rotate(22.5) rotate(22.5)
polygon(shape_taiwan(250)); polygon(shape_taiwan(250));
render() for(dot = dots) { render() for(dot = dots) {
translate(dot[0]) translate(dot[0])
square(0.7 * dot[1]); square(0.7 * dot[1]);

View File

@@ -13,32 +13,33 @@ module spiral_cube(leng, leng_diff, min_leng) {
if(current_leng > min_leng && current_leng > leng_diff && half_leng > pre_height) { if(current_leng > min_leng && current_leng > leng_diff && half_leng > pre_height) {
translate([0, 0, pre_height]) translate([0, 0, pre_height])
scale([factor, factor, 1]) scale([factor, factor, 1])
children(); children();
rotate(atan2(leng_diff, current_leng - leng_diff)) rotate(atan2(leng_diff, current_leng - leng_diff))
spiral_stack( spiral_stack(
sqrt(pow_leng_diff + pow(current_leng - leng_diff, 2)), sqrt(pow_leng_diff + pow(current_leng - leng_diff, 2)),
thickness + pre_height, thickness + pre_height,
i + 1 i + 1
) children(); ) children();
} }
else if(half_leng > pre_height) { else if(half_leng > pre_height) {
translate([0, 0, pre_height]) translate([0, 0, pre_height])
scale([factor, factor, (half_leng - pre_height) / thickness]) scale([factor, factor, (half_leng - pre_height) / thickness])
children(); children();
} }
} }
module spiral_squares() { module spiral_squares() {
difference() { difference() {
translate([0, 0, -half_leng]) translate([0, 0, -half_leng])
spiral_stack(leng) spiral_stack(leng)
translate([0, 0, thickness / 2]) translate([0, 0, thickness / 2])
cube([leng , leng, thickness], center = true); cube([leng , leng, thickness], center = true);
translate([0, 0, 0.001]) translate([0, 0, 0.001])
linear_extrude(leng) linear_extrude(leng)
square(leng, center = true); square(leng, center = true);
} }
} }
@@ -66,13 +67,14 @@ module base(leng) {
difference() { difference() {
difference() { difference() {
sphere(r); sphere(r);
translate([0, 0, -r]) translate([0, 0, -r])
linear_extrude(r) linear_extrude(r)
square(r * 2, center = true); square(r * 2, center = true);
} }
translate([0, 0, leng * sqrt(3) / 2 + leng / 15]) translate([0, 0, leng * sqrt(3) / 2 + leng / 15])
rotate([45, atan2(1, sqrt(2)), 0]) rotate([45, atan2(1, sqrt(2)), 0])
cube(leng * 0.99, center = true); cube(leng * 0.99, center = true);
} }
} }

View File

@@ -21,20 +21,22 @@ module text_container(t, font_size, font_name, r_round_edge, container_height, t
difference() { difference() {
linear_extrude(container_height) linear_extrude(container_height)
minkowski_text(t, font_size, font_name, r_round_edge); minkowski_text(t, font_size, font_name, r_round_edge);
translate([0, 0, thickness]) translate([0, 0, thickness])
linear_extrude(container_height - thickness) linear_extrude(container_height - thickness)
offset(r = -thickness) offset(r = -thickness)
minkowski_text(t, font_size, font_name, r_round_edge); minkowski_text(t, font_size, font_name, r_round_edge);
} }
} }
module text_lid(t, font_size, font_name, r_round_edge, container_height, lid_height, thickness, spacing) { module text_lid(t, font_size, font_name, r_round_edge, container_height, lid_height, thickness, spacing) {
translate([0, 0, lid_height - thickness]) translate([0, 0, lid_height - thickness])
linear_extrude(thickness) linear_extrude(thickness)
offset(r = spacing + thickness) offset(r = spacing + thickness)
minkowski_text(t, font_size, font_name, r_round_edge); minkowski_text(t, font_size, font_name, r_round_edge);
linear_extrude(lid_height) difference() { linear_extrude(lid_height)
difference() {
offset(r = spacing + thickness) offset(r = spacing + thickness)
minkowski_text(t, font_size, font_name, r_round_edge); minkowski_text(t, font_size, font_name, r_round_edge);
offset(r = spacing) offset(r = spacing)

View File

@@ -26,7 +26,8 @@ module text_sphere(tx, font_name, thickness) {
end_angle = end_angle end_angle = end_angle
); );
rotate(-180 / $fn) sphere_spiral_extrude( rotate(-180 / $fn)
sphere_spiral_extrude(
[ [
[thickness, half_thickness], [thickness, half_thickness],
[-half_thickness, half_thickness], [-half_thickness, half_thickness],
@@ -43,16 +44,17 @@ module text_sphere(tx, font_name, thickness) {
for(i = [0:len(points_angles) - 1]) { for(i = [0:len(points_angles) - 1]) {
pa = points_angles[i]; pa = points_angles[i];
translate(pa[0]) rotate(pa[1] + [0, 8, 0]) translate(pa[0])
rotate([90, 0, 90]) rotate(pa[1] + [0, 8, 0])
linear_extrude(half_thickness) rotate([90, 0, 90])
translate([0, -10, 0]) linear_extrude(half_thickness)
text(tx[i], font = font_name, halign = "center"); translate([0, -10, 0])
text(tx[i], font = font_name, halign = "center");
} }
translate([0, 0, -radius]) translate([0, 0, -radius])
linear_extrude(thickness * 2.5) linear_extrude(thickness * 2.5)
circle(radius / 2); circle(radius / 2);
} }
text_sphere(tx, font_name, thickness); text_sphere(tx, font_name, thickness);

View File

@@ -26,14 +26,14 @@ module text_tower(tx, font_name, radius, height, thickness) {
); );
for(i = [0:len(points) - 1]) { for(i = [0:len(points) - 1]) {
translate(points[i]) translate(points[i])
rotate([90, 0, 90 + angle_step * i]) rotate([90, 0, 90 + angle_step * i])
linear_extrude(thickness, center = true) linear_extrude(thickness, center = true)
text( text(
tx[i], tx[i],
font = font_name, font = font_name,
size = font_size, size = font_size,
halign = "center" halign = "center"
); );
} }
rotate(-half_angle_step) rotate(-half_angle_step)
@@ -53,9 +53,10 @@ module text_tower(tx, font_name, radius, height, thickness) {
translate([0, 0, -font_size - half_thickness]) translate([0, 0, -font_size - half_thickness])
body(); body();
rotate(-half_angle_step) rotate(-half_angle_step)
translate([0, 0, -font_size - thickness]) translate([0, 0, -font_size - thickness])
cylinder(h = font_size, r = radius + thickness); cylinder(h = font_size, r = radius + thickness);
} }
text_tower(tx, font_name, radius, height, thickness, $fn = 24); text_tower(tx, font_name, radius, height, thickness, $fn = 24);

View File

@@ -52,9 +52,12 @@ module triangle2square_box(type, tri_side_leng, height, spacing, ring_width, sha
} }
else if(type == "COVER") { else if(type == "COVER") {
box_extrude(height = ring_width * 2, shell_thickness = ring_width) box_extrude(height = ring_width * 2, shell_thickness = ring_width)
mirror([1, 0, 0]) mirror([1, 0, 0])
offset(-ring_width - spacing) 2d_tri_square(); offset(-ring_width - spacing) 2d_tri_square();
linear_extrude(ring_width) mirror([1, 0, 0]) 2d_tri_square();
linear_extrude(ring_width)
mirror([1, 0, 0])
2d_tri_square();
} }
} }

View File

@@ -56,8 +56,8 @@ difference() {
if(chain_hole == "YES") { if(chain_hole == "YES") {
translate([spacing * 1.5, spacing, height / 2]) translate([spacing * 1.5, spacing, height / 2])
linear_extrude(chain_hole_width, center = true) linear_extrude(chain_hole_width, center = true)
hollow_out(chain_hole_width) hollow_out(chain_hole_width)
circle(shaft_r + spacing + chain_hole_width); circle(shaft_r + spacing + chain_hole_width);
} }
} }

View File

@@ -20,8 +20,8 @@ module twist_bottle(model, height, thickness, twist, spacing, convexity, slices)
module outer_container() { module outer_container() {
translate([0, 0, thickness]) translate([0, 0, thickness])
linear_extrude(height = height, twist = twist, slices = slices) linear_extrude(height = height, twist = twist, slices = slices)
hollow_out(thickness) children(); hollow_out(thickness) children();
linear_extrude(thickness) linear_extrude(thickness)
children(); children();
@@ -34,9 +34,9 @@ module twist_bottle(model, height, thickness, twist, spacing, convexity, slices)
children(); children();
translate([0, 0, height]) translate([0, 0, height])
rotate(twist) rotate(twist)
linear_extrude(thickness) linear_extrude(thickness)
children(); children();
} }
if(model == "Outer") { if(model == "Outer") {
@@ -44,9 +44,9 @@ module twist_bottle(model, height, thickness, twist, spacing, convexity, slices)
children(); children();
} else if(model == "Inner") { } else if(model == "Inner") {
translate([0, 0, height + thickness]) translate([0, 0, height + thickness])
rotate([180, 0, 0]) rotate([180, 0, 0])
inner_container() inner_container()
children(); children();
} }
} }
@@ -59,18 +59,18 @@ module heart(radius, center = false) {
$fn = 48; $fn = 48;
translate([-radius * cos45, 0, 0]) translate([-radius * cos45, 0, 0])
rotate(-45) union() { rotate(-45) {
circle(radius); circle(radius);
translate([0, -radius, 0]) translate([0, -radius, 0])
square(diameter); square(diameter);
} }
} }
offsetX = center ? 0 : radius + radius * cos(45); offsetX = center ? 0 : radius + radius * cos(45);
offsetY = center ? 1.5 * radius * sin45 - 0.5 * radius : 3 * radius * sin45; offsetY = center ? 1.5 * radius * sin45 - 0.5 * radius : 3 * radius * sin45;
translate([offsetX, offsetY, 0]) union() { translate([offsetX, offsetY, 0]) {
heart_sub_component(radius); heart_sub_component(radius);
mirror([1, 0, 0]) heart_sub_component(radius); mirror([1, 0, 0]) heart_sub_component(radius);
} }
@@ -80,18 +80,19 @@ if(shape == "Flower") {
twist_bottle(model, height, thickness, twist, spacing, slices) union() { twist_bottle(model, height, thickness, twist, spacing, slices) union() {
for(i = [0:3]) { for(i = [0:3]) {
rotate(90 * i) rotate(90 * i)
translate([radius * 0.5, 0, 0]) translate([radius * 0.5, 0, 0])
circle(radius * 0.5); circle(radius * 0.5);
} }
} }
} else if(shape == "Circle") { } else if(shape == "Circle") {
twist_bottle(model, height, thickness, twist, spacing, slices) difference() { twist_bottle(model, height, thickness, twist, spacing, slices)
difference() {
circle(radius); circle(radius);
union() { union() {
for(a = [0:120:240]) { for(a = [0:120:240]) {
rotate(a) rotate(a)
translate([radius, 0, 0]) translate([radius, 0, 0])
circle(radius / 4); circle(radius / 4);
} }
} }
} }

View File

@@ -31,8 +31,8 @@ module vampire_pen_holder() {
circle(radius); circle(radius);
translate([0, 0, holder_round_r]) translate([0, 0, holder_round_r])
linear_extrude(holder_height) linear_extrude(holder_height)
hollow_out(shell_thickness = 4) circle(30 + 5); hollow_out(shell_thickness = 4) circle(30 + 5);
} }
module sun_glasses() { module sun_glasses() {
@@ -40,14 +40,11 @@ module vampire_pen_holder() {
thickness = 4; thickness = 4;
rotate(-135) rotate(-135)
bend_extrude(size = [80, 20], thickness = thickness, angle = 90) bend_extrude(size = [80, 20], thickness = thickness, angle = 90)
translate([40, 10]) translate([40, 10]) {
polygon(glasses_path);
union() { mirror([1, 0, 0]) polygon(glasses_path);
polygon(glasses_path); }
mirror([1, 0, 0]) polygon(glasses_path);
}
} }
module cloak() { module cloak() {
@@ -71,16 +68,16 @@ module vampire_pen_holder() {
feet(); feet();
color("white") color("white")
translate([0, 0, feet_height - holder_round_r]) translate([0, 0, feet_height - holder_round_r])
holder(); holder();
color("black") color("black")
translate([0, 12.5, holder_height * 5 / 6]) translate([0, 12.5, holder_height * 5 / 6])
sun_glasses(); sun_glasses();
color("red") color("red")
translate([-80, holder_round_r + 0.5, holder_height + feet_height - holder_round_r]) translate([-80, holder_round_r + 0.5, holder_height + feet_height - holder_round_r])
cloak(); cloak();
} }
vampire_pen_holder(); vampire_pen_holder();

View File

@@ -58,12 +58,9 @@ module voronoi_vase(r, h, thickness, num_of_pts, fn, profile_step) {
polygon([for(pt = sections[0]) [pt[0], pt[1]]]); polygon([for(pt = sections[0]) [pt[0], pt[1]]]);
translate([0, 0, h]) translate([0, 0, h])
linear_extrude(thickness) linear_extrude(thickness)
hollow_out(thickness) hollow_out(thickness)
polygon([for(pt = sections[last_section_i]) [pt[0], pt[1]]]); polygon([for(pt = sections[last_section_i]) [pt[0], pt[1]]]);
} }
voronoi_vase(r, h, thickness, num_of_pts, fn, profile_step); voronoi_vase(r, h, thickness, num_of_pts, fn, profile_step);

View File

@@ -40,20 +40,21 @@ module wall(radius, height, thickness) {
eight_pts_star(ro - thickness, thickness); eight_pts_star(ro - thickness, thickness);
translate([0, 0, height]) translate([0, 0, height])
linear_extrude(half_thickness) linear_extrude(half_thickness)
difference() { difference() {
eight_pts_star(ro - thickness, thickness / 4); eight_pts_star(ro - thickness, thickness / 4);
union() { union() {
for(i = [0:7]) { for(i = [0:7]) {
rotate(22.5 + i * 45) rotate(22.5 + i * 45)
translate([-ro, 0]) rotate(-22.5) { translate([-ro, 0])
bk(); rotate(-22.5) {
rotate(45) bk(); bk();
} rotate(45) bk();
}
} }
} }
}
}
} }
module walk_torus83_fort(radius, thickness, height) { module walk_torus83_fort(radius, thickness, height) {
@@ -124,7 +125,7 @@ module walk_torus83_fort(radius, thickness, height) {
stairs(height, stair_number); stairs(height, stair_number);
// walkway without doors // walkway without doors
translate([-leng * 2, 0]) translate([-leng * 2, 0])
rotate([180, 0, 180]) { rotate([180, 0, 180]) {
translate([half_leng2, 0]) translate([half_leng2, 0])
square([leng2, height], center = true); square([leng2, height], center = true);
@@ -154,11 +155,11 @@ module walk_torus83_fort(radius, thickness, height) {
offset = leng / 1.325; offset = leng / 1.325;
for(i = [0:7]) { for(i = [0:7]) {
rotate(45 * i) rotate(45 * i)
translate([offset, offset, 0]) translate([offset, offset, 0])
one_burst(leng, thickness, height, stair_number); one_burst(leng, thickness, height, stair_number);
rotate(45 * i + 22.5) rotate(45 * i + 22.5)
translate([radius + thickness / 1.75, 0]) translate([radius + thickness / 1.75, 0])
tower(thickness * 1.25, height * 1.125); tower(thickness * 1.25, height * 1.125);
} }
} }