#!/usr/bin/perl -w
# $URL: svn+ssh://mrwhat@ssh.boim.com/home/mrwhat/svn/Walker/trunk/lc20crankLinksP1.pl $
# $Id: lc20crankLinksP1.pl 354 2014-01-16 15:30:19Z mrwhat $
#
# script to draw thin Jansen walker crank arms for laser cutting in SVG
$preview = $#ARGV < 0;  # set to 0 for actual size code generation... will generate REAL code if given any argument

# ponoko laser cutting sheets come in 181x181mm, 384x384mm, 384 wide x 790mm long
$wPx = 181;  # width of drawing, pixels?!?? -- most programs seem to ignore units, use mm
$hPx = 181;  # height of drawing, pixels?!??

require 'laserCutPartsGroups.pl';
require 'JansenDefs.pl';

&printPonokoHeader($wPx,$hPx,$preview);

&drawCrankLinkGroup(7.5,7.5,0,$CH);
&drawCrankLinkGroup(105.5,7.5,0,$CD,0,$fuzz*0.4);  # short standoffs tend to be a wee bit wider.

### main gear sides (optional.  could be 3mm)
#for (local $i=0;$i<4;$i++){ &roundSpacer((2*$drivePlateOR+.1)*$i,150,$drivePlateOR,$irS); }

# At this time, each robot uses 16 2mm stackers
#print "<g transform=\"translate(.1,113.8)\">";
print "<g transform=\"translate(113,113.8)\">";
for (local $i=0; $i<6;$i++) { &stackerRow(3,10*$i,$i+1?1:0); }
print "</g>\n";

print "\n<desc>Outer plates for drive gear</desc>\n";
local $x0 = $drivePlateOR+.4;
local $y0 = 127.5;
local $ra = $irA-$fuzz*.3; # let plates be tight on A-axle standoffs
local $rGear=16;
local $dx = 2*$drivePlateOR+.25;
&printGearSide($x0,$y0,$ra,$rGear,$drivePlateOR); $x0 += $dx;
&printGearSide($x0,$y0,$ra,$rGear,$drivePlateOR); $x0 += $dx*0.5; $y0 += $dx*.865; 
&printGearSide($x0,$y0,$ra,$rGear,$drivePlateOR); $x0 -= $dx;
# add a spare, just in case:
&printGearSide($x0,$y0,$ra,$rGear,$drivePlateOR); $x0 += $dx*1.5; $y0 -= $dx*.865;
&printGearSide($x0,$y0,$ra,$rGear,$drivePlateOR);

=begin comment
##-- change to use nylon washers
#### need 16 thin spacers for cranklinks (+ some spares?)
local $ds = 12.7;  # space between spacers
local $rs = 6.2;   # outer radius of crank spacers
local $y0 = 115.4;#152;
local $x0 = 36.4;
for (local $j=0;$j<6;$j++) { &roundSpacer( 6.8+$j*$ds+$x0,$y0   ,$rs,$irC); }
for (local $j=0;$j<5;$j++) { &roundSpacer(13.1+$j*$ds+$x0,$y0+11,$rs,$irC); }
for (local $j=0;$j<6;$j++) { &roundSpacer( 6.8+$j*$ds+$x0,$y0+22,$rs,$irC); }
=end
=cut

print "</g>\n";  # end of mm scale 
print "</g>\n";  # end of cut-line drawing group
print "</svg>\n"; # end of drawing
