1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-07 23:37:13 +02:00
This commit is contained in:
Justin Lin
2022-04-06 17:02:32 +08:00
parent 0b23e5666a
commit adf07c5da8
8 changed files with 25 additions and 36 deletions

View File

@@ -16,8 +16,8 @@ module tiled_line_ring(radius, height, line_diameter) {
lines = [ lines = [
for(tile = tile_truchet(size)) for(tile = tile_truchet(size))
let( let(
x = tile[0], x = tile.x,
y = tile[1], y = tile.y,
i = tile[2] i = tile[2]
) )
if(i <= 1) [ if(i <= 1) [

View File

@@ -11,11 +11,10 @@ module tiled_line_torus(size, twist, line_diameter = 1) {
lines = [ lines = [
for(tile = tile_truchet(size)) for(tile = tile_truchet(size))
let( let(
x = tile[0], x = tile.x,
y = tile[1], y = tile.y
i = tile[2]
) )
i <= 1 ? [[x, y], [x + 1, y + 1]] : [[x + 1, y], [x, y + 1]] tile[2] <= 1 ? [[x, y], [x + 1, y + 1]] : [[x + 1, y], [x, y + 1]]
]; ];
half_line_diameter = line_diameter / 2; half_line_diameter = line_diameter / 2;

View File

@@ -6,11 +6,10 @@ tile_width = 5;
line_width = 1; line_width = 1;
for(tile = tile_truchet(size)) { for(tile = tile_truchet(size)) {
x = tile[0]; x = tile.x;
y = tile[1]; y = tile.y;
i = tile[2];
if(i <= 1) { if(tile[2] <= 1) {
line2d([x, y] * tile_width , [x + 1, y + 1] * tile_width, width = line_width); line2d([x, y] * tile_width , [x + 1, y + 1] * tile_width, width = line_width);
} }
else { else {

View File

@@ -8,10 +8,9 @@ line_width = 1;
$fn = 4; // 4, 8, 12 .... $fn = 4; // 4, 8, 12 ....
for(tile = tile_truchet(size)) { for(tile = tile_truchet(size)) {
x = tile[0]; x = tile.x;
y = tile[1]; y = tile.y;
i = tile[2]; if(tile[2] <= 1) {
if(i <= 1) {
translate([x, y] * tile_width) translate([x, y] * tile_width)
arc(0.5 * tile_width, [0, 90], line_width); arc(0.5 * tile_width, [0, 90], line_width);
translate([x + 1, y + 1] * tile_width) translate([x + 1, y + 1] * tile_width)

View File

@@ -32,11 +32,9 @@ draw_tubes(
module draw_tubes(tiles, tileW) { module draw_tubes(tiles, tileW) {
rows = len(tiles); rows = len(tiles);
columns = len(tiles[0]); columns = len(tiles[0]);
for(y = [0:rows - 1]) { for(y = [0:rows - 1], x = [0:columns - 1]) {
for(x = [0:columns - 1]) { translate([x, rows - y - 1] * tileW)
translate([x, rows - y - 1] * tileW)
tube_tile(tiles[y][x], tileW); tube_tile(tiles[y][x], tileW);
}
} }
} }

View File

@@ -15,11 +15,8 @@ module tube_box(size, tile_width) {
translate([eighth_w, eighth_w, eighth_w] + [tile_width, tile_width, 0] / 2) translate([eighth_w, eighth_w, eighth_w] + [tile_width, tile_width, 0] / 2)
for(tile = tile_w2e(size)) { for(tile = tile_w2e(size)) {
x = tile[0]; translate([tile.x, tile.y] * tile_width)
y = tile[1]; tube_tile(tile[2], tile_width);
i = tile[2];
translate([x, y] * tile_width)
tube_tile(i, tile_width);
} }
box_extrude(height = tile_width, shell_thickness = eighth_w) box_extrude(height = tile_width, shell_thickness = eighth_w)

View File

@@ -23,17 +23,16 @@ pts_angles = golden_spiral(
a_step = 360 / spirals; a_step = 360 / spirals;
cells = [ cells = [
for(i = [0:spirals - 1]) for(i = [0:spirals - 1], pt_angle = pts_angles)
for(pt_angle = pts_angles) ptf_rotate(pt_angle[0], i * a_step)
ptf_rotate(pt_angle[0], i * a_step)
]; ];
noised = [ noised = [
for(y = [-half_size[1]:pixel_step:half_size[1]]) for(y = [-half_size[1]:pixel_step:half_size[1]])
[ [
for(x = [-half_size[0]:pixel_step:half_size[0]]) for(x = [-half_size[0]:pixel_step:half_size[0]])
let(n = nz_cell(cells, [x, y] * height_factor) ) let(n = nz_cell(cells, [x, y] * height_factor) )
[x, y, n < half_pixel_step ? half_pixel_step : n] [x, y, n < half_pixel_step ? half_pixel_step : n]
] ]
]; ];
sf_thicken(noised, thickness); sf_thicken(noised, thickness);

View File

@@ -19,14 +19,12 @@ module voronoi_holder() {
difference() { difference() {
bend_extrude(size = size, thickness = thickness * 3, angle = 360, frags = frags) bend_extrude(size = size, thickness = thickness * 3, angle = 360, frags = frags)
render()
difference() { difference() {
square(size); square(size);
render() for(cell = cells) {
for(cell = cells) { offset(-half_spacing)
offset(-half_spacing)
polygon(cell[1]); polygon(cell[1]);
} }
} }
linear_extrude(size[1] - thickness) linear_extrude(size[1] - thickness)
arc(radius = r, angle = 360, width = thickness, $fn = frags); arc(radius = r, angle = 360, width = thickness, $fn = frags);