Skip to content

Instantly share code, notes, and snippets.

@kazuho
Last active March 20, 2023 00:49
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 kazuho/e09c90121cd3d5450fee5d4261150abd to your computer and use it in GitHub Desktop.
Save kazuho/e09c90121cd3d5450fee5d4261150abd to your computer and use it in GitHub Desktop.
// パラメータ
square_size = 40; // マス目の大きさ (mm)
board_size = 4; // チェス盤の大きさ (8x8)
thick = 10;
hole_width = 100;
hole_height = 5;
hole_depth = 5;
difference () {
difference () {
// base
cube([square_size * board_size, square_size * board_size, thick]);
// edges
for (i = [0 : board_size - 1]) {
for (j = [0 : board_size - 1]) {
if ((i + j) % 2 == 0) {
translate([i * square_size, j * square_size, 0]) {
intersection () {
translate([0, 0, thick - 1.5])
cube([square_size, square_size, 1.5]);
translate([square_size, square_size, thick])
rotate([90, 180, 0])
linear_extrude(height = square_size)
polygon(points = [[0, 0], [square_size, 0], [square_size / 2, square_size / 2]]);
translate([0, square_size, thick])
rotate([90, 180, 90])
linear_extrude(height = square_size)
polygon(points = [[0, 0], [square_size, 0], [square_size / 2, square_size / 2]]);
}
}
}
}
}
}
// hole
translate([(square_size * board_size - hole_width - 0.5) / 2, 0, (thick - hole_height - 0.5) / 2])
cube([hole_width + 0.5, hole_depth + 0.5, hole_height + 0.5]);
}
// ratch
translate([-hole_depth, (square_size * board_size - hole_width) / 2, (thick - hole_height) / 2])
cube([hole_depth, hole_width, hole_height]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment