2021-10-15 00:52:01 +02:00
|
|
|
include <params.scad>
|
|
|
|
|
|
|
|
module goban() {
|
|
|
|
$goban_width = $cell_width*($goban_size-1) +
|
|
|
|
$goban_size*$line_width +
|
|
|
|
$goban_padding*2;
|
|
|
|
|
|
|
|
$goban_length = $cell_length*($goban_size-1) +
|
|
|
|
$goban_size*$line_width +
|
|
|
|
$goban_padding*2;
|
|
|
|
|
|
|
|
difference() {
|
|
|
|
cube([$goban_width, $goban_length, $goban_height]);
|
|
|
|
for(n=[0:$goban_size-1]) {
|
|
|
|
translate([
|
|
|
|
$goban_padding,
|
|
|
|
$goban_padding + n*($cell_length+$line_width),
|
|
|
|
$goban_height - $line_depth])
|
|
|
|
cube([
|
|
|
|
$goban_size*($line_width+$cell_width)-$cell_length,
|
|
|
|
$line_width,
|
|
|
|
$line_depth+1
|
|
|
|
]);
|
|
|
|
translate([
|
|
|
|
$goban_padding + n*($cell_width+$line_width),
|
|
|
|
$goban_padding,
|
|
|
|
$goban_height - $line_depth])
|
|
|
|
cube([
|
|
|
|
$line_width,
|
|
|
|
$goban_size*($line_width+$cell_length)-$cell_length,
|
|
|
|
$line_depth+1
|
|
|
|
]);
|
|
|
|
for(y=[0:$goban_size-1]) {
|
|
|
|
translate([
|
|
|
|
$goban_padding + n*($cell_width+$line_width),
|
|
|
|
$goban_padding + y*($cell_length+$line_width),
|
|
|
|
-1
|
|
|
|
]) union() {
|
2022-03-22 13:14:54 +01:00
|
|
|
translate([0, 0, 1 + $goban_height - $goban_hole_height])
|
2021-10-15 00:52:01 +02:00
|
|
|
cylinder(
|
2022-03-22 13:14:54 +01:00
|
|
|
h=$goban_hole_height+1,
|
2021-10-15 00:52:01 +02:00
|
|
|
r=$stone_radius+$stone_clearance,
|
2022-03-22 13:14:54 +01:00
|
|
|
$fn=100);
|
2021-10-15 00:52:01 +02:00
|
|
|
if(search(n+1, $hoshi_pos) && search(y+1, $hoshi_pos)) {
|
|
|
|
cylinder(
|
|
|
|
h=$goban_height+1,
|
|
|
|
r=$hoshi_radius,
|
2022-03-22 13:14:54 +01:00
|
|
|
$fn=100);
|
2021-10-15 00:52:01 +02:00
|
|
|
} else {
|
|
|
|
cylinder(
|
|
|
|
h=$goban_height+1,
|
|
|
|
r=$goban_hole_radius,
|
2022-03-22 13:14:54 +01:00
|
|
|
$fn=100);
|
2021-10-15 00:52:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
goban();
|