| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- module tower(radius, height) {
- // groove = .75;
- // target_brick_width = 10;
- // target_brick_height = 5;
- // brick_depth = 5;
- circum = 2 * radius * PI;
- bricks = floor(circum / target_brick_width);
- brick_width_deg = 360 / bricks;
- rings = floor(height / target_brick_height);
- brick_height = height / rings;
- $fn = bricks;
- module ring(n) {
- start_deg = 0;
- end_deg = brick_width_deg;
- translate([0, 0, -1]) {
- if (n > 1) {
- // Left groove
- for (i=[0:bricks]) {
- translate([radius * cos(brick_width_deg * i), radius * sin(brick_width_deg * i), 1]) {
- rotate([0, 0, 45 + brick_width_deg * i]) {
- cube(size=[groove, groove, brick_height], center=false);
- }
- }
- }
- }
-
- }
- // Bottom groove
- rotate_extrude() {
- translate([radius * cos(start_deg), radius * sin(start_deg)]) {
- rotate([0, 0, 45]) {
- square(size=[groove, groove], center=true);
- }
- }
- }
- }
- module loop(n) {
- if (n > 0) {
- union(){
- ring(n);
- rotate([0,0,brick_width_deg / 2]) {
- translate([0,0,brick_height]) {
- loop(n - 1);
- }
- }
- }
- }
- }
- difference() {
- cylinder(r=radius, h=height, center=false);
- translate([0,0,-1]) {
- cylinder(r=radius - brick_depth, h=height + 2, center=false);
- }
- if (!draft) {
- loop(rings + 1);
- }
- }
- }
|