From: Ian Jackson Date: Sun, 16 Feb 2020 16:11:03 +0000 (+0000) Subject: quacks-ingredients: wip X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=reprap-play.git;a=commitdiff_plain;h=d3ba35154fff3230c0e241726183795e557673ae quacks-ingredients: wip Signed-off-by: Ian Jackson --- diff --git a/quacks-ingredients.scad b/quacks-ingredients.scad new file mode 100644 index 0000000..71a3bd6 --- /dev/null +++ b/quacks-ingredients.scad @@ -0,0 +1,97 @@ +// -*- C -*- + +token_dia = 18; +spot_dia = 4; +spot_gap = spot_dia / 3.0; + +thick = 1.5; + +multicolour_gap = 0.15; // each side +initial_layer_thick = 0.400; +//initial_layer_width = 0.750; +final_layer_thick = 0.250; + +$nspots = 3; +$spots_absent = false; +$spots_plusgap = false; + +$fs=0.1; +$fa=1; + +module Spots_Extrude_Lower(){ + d = $spots_plusgap ? 1 : 0; + translate([0,0,-d]) + linear_extrude(height= initial_layer_thick + d) + children(0); +} + +module Spots_Extrude_Upper(){ + d = $spots_plusgap ? 1 : 0; + translate([0,0, thick + d]) + mirror([0,0, 1]) + linear_extrude(height= final_layer_thick + d) + children(0); +} + +module SpotAt(condition, xy) { + if (condition == !$spots_absent) { + echo(condition, $spots_absent, "Y"); + translate(xy * (spot_gap + spot_dia) * sqrt(0.5)) + circle(r= spot_dia/2); + } else { + echo(condition, $spots_absent, "N"); + } +} + +module Token_Spots(){ + SpotAt(($nspots % 2) > 0, [0,0]); + SpotAt($nspots >= 2, [ 1, 1]); + SpotAt($nspots >= 2, [-1,-1]); + SpotAt($nspots >= 4, [ 1,-1]); + SpotAt($nspots >= 4, [-1, 1]); +} + +module Token_Spots_All(){ + $nspots = 5; + Token_Spots(); +} + +module Token_L1(){ + Spots_Extrude_Lower() + Token_Spots(); +} + +module Token_L2(){ + $spots_absent = true; + Spots_Extrude_Lower() + Token_Spots(); +} + +module Token_L3(){ + $spots_plusgap = true; + difference(){ + linear_extrude(height=thick) + circle(r=token_dia/2); + Spots_Extrude_Lower() Token_Spots_All(); + Spots_Extrude_Upper() Token_Spots_All(); + } +} + +module Token_L4(){ + $spots_absent = true; + Spots_Extrude_Upper() + Token_Spots(); +} + +module Token_L5(){ + Spots_Extrude_Upper() + Token_Spots(); +} + +module Demo(){ + color("red") { Token_L3(); } + color("white") { Token_L1(); Token_L5(); } + color("black") { Token_L2(); Token_L4(); } +} + +Demo();