62 lines
2.1 KiB
OpenSCAD
62 lines
2.1 KiB
OpenSCAD
|
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() {
|
||
|
translate([0, 0, 1 + $goban_height - $stone_height*0.60])
|
||
|
cylinder(
|
||
|
h=$stone_height*0.60+1,
|
||
|
r=$stone_radius+$stone_clearance,
|
||
|
$fn=200);
|
||
|
if(search(n+1, $hoshi_pos) && search(y+1, $hoshi_pos)) {
|
||
|
cylinder(
|
||
|
h=$goban_height+1,
|
||
|
r=$hoshi_radius,
|
||
|
$fn=200);
|
||
|
} else {
|
||
|
cylinder(
|
||
|
h=$goban_height+1,
|
||
|
r=$goban_hole_radius,
|
||
|
$fn=200);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
goban();
|