5 spot_gap = spot_dia / 3.0;
9 multicolour_gap = 0.15; // each side
10 initial_layer_thick = 0.400;
11 initial_layer_width = 0.750;
12 final_layer_thick = 0.250;
16 $spots_absent = false;
17 $spots_plusgap = false;
22 module Spots_Extrude_Lower(){
23 d = $spots_plusgap ? 1 : 0;
25 linear_extrude(height= initial_layer_thick + d)
29 module Spots_Extrude_Upper(){
30 d = $spots_plusgap ? 1 : 0;
31 translate([0,0, thick + d])
33 linear_extrude(height= final_layer_thick + d)
37 module SpotAt(condition, xy) {
38 if (condition == !$spots_absent) {
39 echo(condition, $spots_absent, "Y");
40 translate(xy * (spot_gap + spot_dia) * sqrt(0.5))
41 circle(r= spot_dia/2 +
42 ($spots_plusgap ? multicolour_gap : 0));
44 echo(condition, $spots_absent, "N");
49 SpotAt(($nspots % 2) > 0, [0,0]);
50 SpotAt($nspots >= 2, [ 1, 1]);
51 SpotAt($nspots >= 2, [-1,-1]);
52 SpotAt($nspots >= 4, [ 1,-1]);
53 SpotAt($nspots >= 4, [-1, 1]);
56 module Token_Spots_All(){
73 $spots_plusgap = true;
75 linear_extrude(height=thick)
76 circle(r=token_dia/2);
77 Spots_Extrude_Lower() Token_Spots_All();
78 Spots_Extrude_Upper() Token_Spots_All();
93 module Demo(){ ////toplevel
94 color("red") { Token_L3(); }
95 color("white") { Token_L1(); Token_L5(); }
96 color("black") { Token_L2(); Token_L4(); }
100 zs = [ initial_layer_thick,
106 base_sz = token_dia * [ 6, 1.5 ];
107 sz = base_sz + phase * initial_layer_width * 2 * [1,1];
108 linear_extrude(height= initial_layer_thick) {
110 square(center=true, sz + initial_layer_width * 2 * [1,1]);
111 square(center=true, sz);
114 translate([-base_sz[0]/2, (phase-3)*(multicolour_post + multicolour_gap)])
115 linear_extrude(height= zs[phase-1])
116 square(multicolour_post);
120 for ($nspots = [1,2,3,4]) {
121 translate(($nspots - 2) * (token_dia + 3) * [1,0])
126 module Test_L1(){ ////toplevel
127 Frame(1); Tests() Token_L1();
129 module Test_L2(){ ////toplevel
130 Frame(2); Tests() Token_L2();
132 module Test_L3(){ ////toplevel
133 Frame(3); Tests() Token_L3();
135 module Test_L4(){ ////toplevel
136 Frame(4); Tests() Token_L4();
138 module Test_L5(){ ////toplevel
139 Frame(5); Tests() Token_L5();