#!/usr/bin/perl -w
# $URL: svn+ssh://mrwhat@ssh.boim.com/home/mrwhat/svn/Walker/trunk/lc20_30_1x2.pl $
# $Id: lc20_30_1x2.pl 309 2013-11-04 17:17:45Z mrwhat $
#
# script to draw thin Jansen walker parts for laser cutting in SVG
# This layout is intended for Pololu 1x2' 3mm stock
$preview = $#ARGV < 0;  # set to 0 for actual size code generation... will generate REAL code if given any argument

# pololu laser cutting sheets come in 1x1, 1x2' ...  minus .25"

# width of drawing, mm... pixels?!?? -- most programs seem to ignore units, use mm
$wPx = 23.75 * 25.4;
$hPx = 11.75 * 25.4;

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

# this header might work for start of Pololu drawings too
&printPonokoHeader($wPx,$hPx,$preview);
&drawPololuFiducial(394,1); # add Pololu fiducial

&printPayloadCovers( 68,5.5,0);
#&printPayloadCovers(311,5.5,0,1);

&drawEFgroup( 10,105,0,12); ### EF
&drawEFgroup( 80,195,0, 4); ### EF
#&drawEFgroup(150,195,0, 7); ### EF
#&drawEFgroup(220,195,0, 6); ### EF
&drawBHgroup( 80,258,0,3); ### BH
&drawBHgroup(150,194,0,7); ### BH
&drawBHgroup(216,194,0,6); ### BH
#&drawBHgroup(423,194,0,7); ### BH
#&drawBHgroup(490,194,0,7); ### BH
&drawBEDforkGroup(281,193,0,8); ### forks for CD on BED, need a total of 8
&drawWideForkGroup(355,192,0,$irB,8); ### B-forks for BED, and H-fors for foot


## main gear side pannels
&roundSpacer(321,26,$drivePlateOR,$irA-$fuzz*.3);
&roundSpacer(336,74,$drivePlateOR,$irA-$fuzz*.3);
&roundSpacer(371,37,$drivePlateOR,$irA-$fuzz*.3);
&roundSpacer(378,102,$drivePlateOR,$irA-$fuzz*.3);

## motor gears
local $rShaft = 1.5 + 0.4*$fuzz;
local $dShaft = 1   + 0.2*$fuzz;
&printGear(278, 61,$gearPitch,$teethMotor,$rShaft,$dShaft);
&printGear(358,154,$gearPitch,$teethMotor,$rShaft,$dShaft);

### spacers, need at least 24
print "<desc>Spacers, need at least 24</desc>
<g transform=\"translate(5,291)\">";
&spacerRow(3,0,0);print "</g>\n";
print "<g transform=\"translate(209,280)\">";
&spacerRow(3,0,2);print "</g>\n";
print "<g transform=\"translate(207,290)\">";
&spacerRow(7,0,0);print "</g>\n";
print "<g transform=\"translate(395,185.4) rotate(-90)\">";
&spacerRow(3,0,4);
&spacerRow(3,10,4+1);
#&spacerRow(9,20,1);
print "</g>\n";
print "<g transform=\"translate(250,25)\">";
&spacerRow(2,0,0);
&spacerRow(2,-10,2);
print "</g>\n";
print "<g transform=\"translate(330,105)\">";
&spacerRow(1,0,0);
&spacerRow(1,10,1);
print "</g>\n";
print "<g transform=\"translate(362,70)\">";
&spacerRow(2,0,0);print "</g>\n";

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