chiark / gitweb /
lemon-stand.scad.pl: octagonal channels
[reprap-play.git] / lemon-stand.scad.pl
index 048f4d7bdb6813ad3a4c4887c534d7d4ef3183f4..e4b32ae1928cfb8874e52ded2ed8a06903d1ac7d 100755 (executable)
@@ -7,18 +7,20 @@ use IO::File;
 use Data::Dumper;
 use constant tau => pi*2;
 
+my $ellipse = 25;
+my $circle = 7;
+my $channel = 5;
+my $xscale = 35/25;
+my $N = 30; #180; # around ellipse
+my $M = 20; #80; # around each circle
+my @channeldistprops = (0, 1/3, 2/3);
+
 print <<END;
 // -*- C -*-
 // *** AUTOGENERATED - DO NOT EDIT ***
 END
 
-my $ellipse = 20;
-my $circle = 6;
-my $channel = 5;
-my $xscale = 2;
-my $N = 30; # around ellipse
-my $M = 20; # around each circle
-my @channeldistprops = (0, 1/3, 2/3);
+print "torusyup = ", ($circle / sqrt(2)), ";\n";
 
 our @ellipse = map {
     my $theta = tau * $_ / $N;
@@ -129,7 +131,8 @@ sub channels(){
        print "  rotate([0,0,$angle*360/",tau,"])\n";
        print "  rotate([0,90,0])\n";
        print "  translate([0,0, -2*$circle])\n";
-       print "  cylinder(r=$channel, h=4*$circle, \$fn=$M);\n";
+       print "  rotate([0,0,360/8/2])\n";
+       print "  cylinder(r=$channel, h=4*$circle, \$fn=8);\n";
     }
     print "}\n";
 }
@@ -142,5 +145,13 @@ STDOUT->error and die $!;
 STDOUT->flush or die $!;
 
 __DATA__
-Torusy();
-Channels();
+module Stand(){
+    difference(){
+       translate([0,0,torusyup])
+           Torusy();
+       Channels();
+       translate([-200,-200,-50])
+           cube([400,400,50]);
+    }
+}
+Stand();