chiark / gitweb /
ksafe-base: wip web
[reprap-play.git] / electron-token.scad.pl
index 8c1d10f54338529a21998c8656a3db2ba2fdaa25..dc24c5ae5f1cabea4889ef909dd4cb6d6e13f040 100755 (executable)
@@ -7,16 +7,13 @@ use IO::File;
 use Data::Dumper;
 use constant tau => pi*2;
 
-my $ellipse = 25 / 2;
-my $circle = 7 / 2;
-my $channelh = 3;
-my $channelw = 4;
-my $xscale = 35 / 25;
+my $ellipse = 60 / 2;
+my $circle = 3.5 / 2;
+my $xscale = 33 / 100;
 my $N = 180; # around ellipse
 my $M = 80; # around each circle
-my @channeldistprops = (0, 1/3, 2/3);
 
-my $NMdiv = $ENV{'LEMONSTAND_COARSE'} || 1;
+my $NMdiv = $ENV{'ELECTRONTOKEN_COARSE'} || 1;
 
 $M /= $NMdiv;
 $N /= $NMdiv;
@@ -124,41 +121,20 @@ sub infodistprop ($) {
     die "$distprop ?";
 }
 
-sub channels(){
-    print "module Channels(){\n";
-    
-    foreach my $cdp (
-                    (map { 0.5 *  $_    } @channeldistprops),
-                    (map { 0.5 * ($_+1) } @channeldistprops),
-                   ) {
-       my ($ctr, $along) = infodistprop($cdp);
-       my $angle = atan2(-$along->[0], $along->[1]);
-       print "  translate(",scadvec($ctr),")\n";
-       print "  rotate([0,0,$angle*360/",tau,"])\n";
-       print "  rotate([0,90,0])\n";
-       print "  translate([0,0, -2*$circle])\n";
-       print "  scale([1, $channelw/$channelh/2, 1])\n";
-       print "  rotate([0,0,360/8/2])\n";
-       print "  cylinder(r=$channelh, h=4*$circle, \$fn=8);\n";
-    }
-    print "}\n";
-}
-
-channels();
-
 while (<DATA>) { print };
 
 STDOUT->error and die $!;
 STDOUT->flush or die $!;
 
 __DATA__
-module Stand(){
+module Token(){
     difference(){
-       translate([0,0,torusyup])
+       for (rot=[ 0,120,240 ])
+           rotate([0,0, rot])
+           translate([0,0,torusyup])
            Torusy();
-       Channels();
        translate([-200,-200,-50])
            cube([400,400,50]);
     }
 }
-Stand();
+Token();