Skip to content

Instantly share code, notes, and snippets.

@kakkun61
Created February 27, 2020 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kakkun61/fa8e9eae37c99e4cc2d42ddd5194d2c3 to your computer and use it in GitHub Desktop.
Save kakkun61/fa8e9eae37c99e4cc2d42ddd5194d2c3 to your computer and use it in GitHub Desktop.
block_width = 10;
block_height = 4;
block_thickness = 1;
clay_width = 0.5;
clay_thickness = 0.5;
unit_width = block_width + 2 * clay_width;
unit_height = block_height + 2 * clay_width;
module block() {
color("brown")
cube([block_width, block_height, block_thickness]);
}
module clay() {
color("grey")
cube([unit_width, unit_height, clay_thickness]);
}
module unit() {
translate([clay_width, clay_width, 0])
block();
clay();
}
module block_half() {
color("brown")
cube([block_width / 2, block_height, block_thickness]);
}
module clay_half() {
color("grey")
cube([unit_width / 2, unit_height, clay_thickness]);
}
module unit_half() {
translate([clay_width, clay_width, 0])
block_half();
clay_half();
}
module wall(width, height) {
for (w = [0:width]) {
for (h = [0:height]) {
if (0 == h % 2) {
translate([w * unit_width, h * unit_height, 0])
unit();
} else {
translate([0, h * unit_height, 0]) {
if (w == 0) {
translate([unit_width / 2, unit_height, 0])
rotate([0, 0, 180])
unit_half();
} else {
translate([(w - 0.5) * unit_width, 0, 0])
unit();
}
if (w == width) {
translate([(w + 0.5) * unit_width, 0, 0])
unit_half();
}
}
}
}
}
}
wall(10, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment