mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-27 08:25:45 +02:00
rename
This commit is contained in:
203
examples/tiles/2_edge_wang_tiles_basic.scad
Normal file
203
examples/tiles/2_edge_wang_tiles_basic.scad
Normal file
@@ -0,0 +1,203 @@
|
||||
use <experimental/2_edge_wang_tiles.scad>;
|
||||
use <arc.scad>;
|
||||
|
||||
rows = 10;
|
||||
columns = 15;
|
||||
tile_width = 10;
|
||||
tile_thickness = 2;
|
||||
$fn = 24;
|
||||
|
||||
2_edge_wang_tiles(rows, columns, tile_width) {
|
||||
sample_tile(0, tile_width, tile_thickness);
|
||||
sample_tile(1, tile_width, tile_thickness);
|
||||
sample_tile(2, tile_width, tile_thickness);
|
||||
sample_tile(3, tile_width, tile_thickness);
|
||||
sample_tile(4, tile_width, tile_thickness);
|
||||
sample_tile(5, tile_width, tile_thickness);
|
||||
sample_tile(6, tile_width, tile_thickness);
|
||||
sample_tile(7, tile_width, tile_thickness);
|
||||
sample_tile(8, tile_width, tile_thickness);
|
||||
sample_tile(9, tile_width, tile_thickness);
|
||||
sample_tile(10, tile_width, tile_thickness);
|
||||
sample_tile(11, tile_width, tile_thickness);
|
||||
sample_tile(12, tile_width, tile_thickness);
|
||||
sample_tile(13, tile_width, tile_thickness);
|
||||
sample_tile(14, tile_width, tile_thickness);
|
||||
sample_tile(15, tile_width, tile_thickness);
|
||||
}
|
||||
|
||||
translate([0, tile_width * (rows + 1)]) {
|
||||
color("LightGrey")
|
||||
linear_extrude(tile_thickness / 2)
|
||||
square([columns * tile_width, rows * tile_width]);
|
||||
|
||||
color("green")
|
||||
linear_extrude(tile_thickness)
|
||||
2_edge_wang_tiles(rows, columns, tile_width) {
|
||||
path_tile(0, tile_width);
|
||||
path_tile(1, tile_width);
|
||||
path_tile(2, tile_width);
|
||||
path_tile(3, tile_width);
|
||||
path_tile(4, tile_width);
|
||||
path_tile(5, tile_width);
|
||||
path_tile(6, tile_width);
|
||||
path_tile(7, tile_width);
|
||||
path_tile(8, tile_width);
|
||||
path_tile(9, tile_width);
|
||||
path_tile(10, tile_width);
|
||||
path_tile(11, tile_width);
|
||||
path_tile(12, tile_width);
|
||||
path_tile(13, tile_width);
|
||||
path_tile(14, tile_width);
|
||||
path_tile(15, tile_width);
|
||||
}
|
||||
}
|
||||
|
||||
module sample_tile(n, width, thickness) {
|
||||
half_w = width / 2;
|
||||
|
||||
diff_polygons = [
|
||||
[[]],
|
||||
[[[0, 0], [half_w, half_w], [-half_w, half_w]]],
|
||||
[[[0, 0], [half_w, -half_w], [half_w, half_w]]],
|
||||
[[[-half_w, half_w], [half_w, -half_w], [half_w, half_w]]],
|
||||
[[[0, 0], [-half_w, -half_w], [half_w, -half_w]]],
|
||||
[
|
||||
[[0, 0], [half_w, half_w], [-half_w, half_w]],
|
||||
[[0, 0], [-half_w, -half_w], [half_w, -half_w]]
|
||||
],
|
||||
[[[-half_w, -half_w], [half_w, -half_w], [half_w, half_w]]],
|
||||
[[[0, 0], [-half_w, -half_w], [half_w, -half_w], [half_w, half_w], [-half_w, half_w]]],
|
||||
[[[0, 0], [-half_w, half_w], [-half_w, -half_w]]],
|
||||
[[[-half_w, half_w], [-half_w, -half_w], [half_w, half_w]]],
|
||||
[
|
||||
[[0, 0], [-half_w, half_w], [-half_w, -half_w]],
|
||||
[[0, 0], [half_w, -half_w], [half_w, half_w]]
|
||||
],
|
||||
[[[0, 0], [half_w, -half_w], [half_w, half_w], [-half_w, half_w], [-half_w, -half_w]]],
|
||||
[[[-half_w, half_w], [-half_w, -half_w], [half_w, -half_w]]],
|
||||
[[[0, 0], [half_w, half_w], [-half_w, half_w], [-half_w, -half_w], [half_w, -half_w]]],
|
||||
[[[0, 0], [-half_w, half_w], [-half_w, -half_w], [half_w, -half_w], [half_w, half_w]]],
|
||||
[[[half_w, half_w], [-half_w, half_w], [-half_w, -half_w], [half_w, -half_w]]]
|
||||
];
|
||||
|
||||
color("blue")
|
||||
linear_extrude(thickness)
|
||||
difference() {
|
||||
square(width, center = true);
|
||||
for(diff_polygon = diff_polygons[n]) {
|
||||
offset(0.01) polygon(diff_polygon);
|
||||
}
|
||||
}
|
||||
|
||||
color("yellow")
|
||||
linear_extrude(thickness / 2)
|
||||
square(width, center = true);
|
||||
}
|
||||
|
||||
module path_tile(n, width) {
|
||||
half_w = width / 2;
|
||||
quarter_w = width / 4;
|
||||
|
||||
module tile1() {
|
||||
difference() {
|
||||
square(width, center = true);
|
||||
circle(quarter_w);
|
||||
translate([0, quarter_w])
|
||||
square([quarter_w, quarter_w * 2], center = true);
|
||||
}
|
||||
}
|
||||
|
||||
module tile3() {
|
||||
difference() {
|
||||
square(width, center = true);
|
||||
translate([half_w, half_w])
|
||||
arc(radius = half_w, angle = [180, 270], width = quarter_w);
|
||||
}
|
||||
}
|
||||
|
||||
module tile5() {
|
||||
difference() {
|
||||
square(width, center = true);
|
||||
square([quarter_w, width], center = true);
|
||||
}
|
||||
}
|
||||
|
||||
module tile7() {
|
||||
intersection() {
|
||||
square(width, center = true);
|
||||
translate([half_w, half_w])
|
||||
circle(1.5 * quarter_w);
|
||||
}
|
||||
intersection() {
|
||||
square(width, center = true);
|
||||
translate([half_w, -half_w])
|
||||
circle(1.5 * quarter_w);
|
||||
}
|
||||
intersection() {
|
||||
square(width, center = true);
|
||||
translate([-1.25 * half_w, 0])
|
||||
square(width, center = true);
|
||||
}
|
||||
}
|
||||
|
||||
module tile15() {
|
||||
for(i = [0:3]) {
|
||||
rotate(90 * i)
|
||||
intersection() {
|
||||
square(width, center = true);
|
||||
translate([half_w, half_w])
|
||||
circle(1.5 * quarter_w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(n == 0) {
|
||||
square(width, center = true);
|
||||
}
|
||||
else if(n == 1) {
|
||||
tile1();
|
||||
}
|
||||
else if(n == 2) {
|
||||
rotate(-90) tile1();
|
||||
}
|
||||
else if(n == 3) {
|
||||
tile3();
|
||||
}
|
||||
else if(n == 4) {
|
||||
rotate(-180) tile1();
|
||||
}
|
||||
else if(n == 5) {
|
||||
tile5();
|
||||
}
|
||||
else if(n == 6) {
|
||||
rotate(-90) tile3();
|
||||
}
|
||||
else if(n == 7) {
|
||||
tile7();
|
||||
}
|
||||
else if(n == 8) {
|
||||
rotate(90) tile1();
|
||||
}
|
||||
else if(n == 9) {
|
||||
rotate(90) tile3();
|
||||
}
|
||||
else if(n == 10) {
|
||||
rotate(90) tile5();
|
||||
}
|
||||
else if(n == 11) {
|
||||
rotate(90) tile7();
|
||||
}
|
||||
else if(n == 12) {
|
||||
rotate(-180) tile3();
|
||||
}
|
||||
else if(n == 13) {
|
||||
rotate(180) tile7();
|
||||
}
|
||||
else if(n == 14) {
|
||||
rotate(270) tile7();
|
||||
}
|
||||
else if(n == 15) {
|
||||
tile15();
|
||||
}
|
||||
}
|
154
examples/tiles/tube_box.scad
Normal file
154
examples/tiles/tube_box.scad
Normal file
@@ -0,0 +1,154 @@
|
||||
use <experimental/2_edge_wang_tiles.scad>;
|
||||
use <box_extrude.scad>;
|
||||
|
||||
rows = 8;
|
||||
columns = 15;
|
||||
tile_width = 10;
|
||||
$fn = 12;
|
||||
|
||||
tube_box(rows, columns, tile_width);
|
||||
|
||||
module tube_box(rows, columns, tile_width) {
|
||||
half_w = tile_width / 2;
|
||||
quarter_w = tile_width / 4;
|
||||
eighth_w = tile_width / 8;
|
||||
|
||||
translate([eighth_w, eighth_w, -eighth_w])
|
||||
2_edge_wang_tiles(rows, columns, tile_width) {
|
||||
tube_tile(0, tile_width);
|
||||
tube_tile(1, tile_width);
|
||||
tube_tile(2, tile_width);
|
||||
tube_tile(3, tile_width);
|
||||
tube_tile(4, tile_width);
|
||||
tube_tile(5, tile_width);
|
||||
tube_tile(6, tile_width);
|
||||
tube_tile(7, tile_width);
|
||||
tube_tile(8, tile_width);
|
||||
tube_tile(9, tile_width);
|
||||
tube_tile(10, tile_width);
|
||||
tube_tile(11, tile_width);
|
||||
tube_tile(12, tile_width);
|
||||
tube_tile(13, tile_width);
|
||||
tube_tile(14, tile_width);
|
||||
tube_tile(15, tile_width);
|
||||
}
|
||||
|
||||
box_extrude(height = tile_width, shell_thickness = eighth_w)
|
||||
square([columns * tile_width + quarter_w, rows * tile_width + quarter_w]);
|
||||
}
|
||||
|
||||
module tube_tile(n, width) {
|
||||
half_w = width / 2;
|
||||
quarter_w = width / 4;
|
||||
sixteenth_w = width / 16;
|
||||
module tile1() {
|
||||
translate([0, half_w])
|
||||
rotate([90, 0, -90]) {
|
||||
rotate_extrude(angle = 90)
|
||||
translate([half_w, 0])
|
||||
circle(quarter_w);
|
||||
|
||||
translate([half_w, 0])
|
||||
rotate([90, 0, 0])
|
||||
linear_extrude(sixteenth_w, center = true)
|
||||
circle(quarter_w * 1.2);
|
||||
|
||||
translate([0, half_w])
|
||||
rotate([0, 90, 0])
|
||||
linear_extrude(sixteenth_w, center = true)
|
||||
circle(quarter_w * 1.2);
|
||||
}
|
||||
}
|
||||
|
||||
module tile3() {
|
||||
mirror([1, 0, 0])
|
||||
translate([-half_w, 0, half_w])
|
||||
rotate([0, 90, 0])
|
||||
tile1();
|
||||
}
|
||||
|
||||
module tile5() {
|
||||
translate([0, 0, half_w])
|
||||
rotate([90, 0, 0]) {
|
||||
linear_extrude(width, center = true)
|
||||
circle(quarter_w);
|
||||
|
||||
translate([0, 0, half_w])
|
||||
linear_extrude(sixteenth_w, center = true)
|
||||
circle(quarter_w * 1.2);
|
||||
|
||||
translate([0, 0, -half_w])
|
||||
linear_extrude(sixteenth_w, center = true)
|
||||
circle(quarter_w * 1.2);
|
||||
}
|
||||
}
|
||||
|
||||
module tile7() {
|
||||
tile5();
|
||||
|
||||
translate([0, 0, half_w])
|
||||
rotate([0, 90, 0]) {
|
||||
linear_extrude(half_w)
|
||||
circle(quarter_w);
|
||||
|
||||
translate([0, 0, half_w])
|
||||
linear_extrude(sixteenth_w, center = true)
|
||||
circle(quarter_w * 1.2);
|
||||
}
|
||||
}
|
||||
|
||||
module tile15() {
|
||||
tile5();
|
||||
rotate(90)
|
||||
tile5();
|
||||
}
|
||||
|
||||
if(n == 0) {
|
||||
// no tube
|
||||
}
|
||||
else if(n == 1) {
|
||||
tile1();
|
||||
}
|
||||
else if(n == 2) {
|
||||
rotate(-90) tile1();
|
||||
}
|
||||
else if(n == 3) {
|
||||
tile3();
|
||||
}
|
||||
else if(n == 4) {
|
||||
rotate(-180) tile1();
|
||||
}
|
||||
else if(n == 5) {
|
||||
tile5();
|
||||
}
|
||||
else if(n == 6) {
|
||||
rotate(-90) tile3();
|
||||
}
|
||||
else if(n == 7) {
|
||||
tile7();
|
||||
}
|
||||
else if(n == 8) {
|
||||
rotate(90) tile1();
|
||||
}
|
||||
else if(n == 9) {
|
||||
rotate(90) tile3();
|
||||
}
|
||||
else if(n == 10) {
|
||||
rotate(90) tile5();
|
||||
}
|
||||
else if(n == 11) {
|
||||
rotate(90) tile7();
|
||||
}
|
||||
else if(n == 12) {
|
||||
rotate(-180) tile3();
|
||||
}
|
||||
else if(n == 13) {
|
||||
rotate(180) tile7();
|
||||
}
|
||||
else if(n == 14) {
|
||||
rotate(270) tile7();
|
||||
}
|
||||
else if(n == 15) {
|
||||
tile15();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user