1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00
dotSCAD/examples/tiles/tube_box.scad

133 lines
2.6 KiB
OpenSCAD
Raw Normal View History

2021-07-29 12:05:18 +08:00
use <experimental/tile_w2e.scad>;
2021-10-04 07:58:45 +08:00
use <select.scad>;
2021-01-15 19:20:53 +08:00
use <box_extrude.scad>;
2021-07-30 11:43:31 +08:00
size = [15, 8];
2021-01-15 19:20:53 +08:00
tile_width = 10;
$fn = 12;
2021-07-30 11:43:31 +08:00
tube_box(size, tile_width);
2021-01-15 19:25:00 +08:00
2021-07-30 11:43:31 +08:00
module tube_box(size, tile_width) {
2021-01-15 19:25:00 +08:00
half_w = tile_width / 2;
quarter_w = tile_width / 4;
eighth_w = tile_width / 8;
2021-07-29 12:05:18 +08:00
2021-07-29 18:54:09 +08:00
translate([eighth_w, eighth_w, eighth_w] + [tile_width, tile_width, 0] / 2)
2021-07-30 11:43:31 +08:00
for(tile = tile_w2e(size)) {
2021-07-29 12:05:18 +08:00
x = tile[0];
y = tile[1];
i = tile[2];
translate([x, y] * tile_width)
tube_tile(i, tile_width);
2021-01-16 22:28:28 +08:00
}
2021-01-15 19:25:00 +08:00
box_extrude(height = tile_width, shell_thickness = eighth_w)
2021-07-30 11:43:31 +08:00
square([size[0] * tile_width + quarter_w, size[1] * tile_width + quarter_w]);
2021-01-15 19:25:00 +08:00
}
2021-01-15 19:20:53 +08:00
module tube_tile(n, width) {
half_w = width / 2;
quarter_w = width / 4;
sixteenth_w = width / 16;
2021-07-29 18:54:09 +08:00
module tile0() {
difference() {
union() {
linear_extrude(width / 2)
circle(quarter_w);
translate([0, 0, half_w])
linear_extrude(sixteenth_w, center = true)
circle(quarter_w * 1.2);
linear_extrude(sixteenth_w, center = true)
circle(quarter_w * 1.2);
}
linear_extrude(width)
circle(quarter_w - quarter_w * 0.2);
}
}
2021-01-15 19:20:53 +08:00
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();
}
2021-07-29 18:54:09 +08:00
2021-07-31 16:16:58 +08:00
select(n) {
2021-07-29 18:54:09 +08:00
tile0();
2021-01-15 19:20:53 +08:00
tile1();
2021-07-29 18:54:09 +08:00
rotate(-90) tile1();
tile3();
rotate(-180) tile1();
tile5();
rotate(-90) tile3();
tile7();
rotate(90) tile1();
rotate(90) tile3();
rotate(90) tile5();
rotate(90) tile7();
rotate(-180) tile3();
rotate(180) tile7();
rotate(270) tile7();
tile15();
2021-01-15 19:20:53 +08:00
}
}