#!/usr/bin/perl -w
# $URL: svn+ssh://mrwhat@ssh.boim.com/home/mrwhat/svn/Walker/trunk/XD20_45_344x384.pl $
# $Id: XD20_45_344x384.pl 398 2014-02-13 14:44:15Z mrwhat $
#
# script to draw thick Jansen walker parts for laser cutting in SVG
#    This version is for 1/4" standoff hinges, with standoff axle and crank-arm
$preview = $#ARGV < 0;  # set to 0 for actual size code generation... will generate REAL code if given any argument

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

# ponoko laser cutting sheets come in 181x181mm, 384x384mm, 384 wide x 790mm long
($wPx,$hPx) = &parseSizeFromFileName($0);  # get this from file name to make SURE it matches

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

&drawFootOct(113,262.7,60);   ##### feet  -- $FH $GH $FG $FGleft $FGperp 
&drawBEDoct(276,299,120);    ### BED
&printMainQuadFlat(263,143,0);
&drawCrankArms(302,40,0,$AC,8);  ### AC, need only 4, put cutting spares

&printPayloadSides(101,9.4,0);


## main pulleys (inside part)
# drive gear (smaller gear, for 30rpm motor)
local $rs = $irS - 0.2 * $fuzz;  # make gear hole TIGHT around #4-40 rod
&printGear( 65,236,$gearPitch,$teethDrive,$rs);  # only need 2, but cutting spares
&printGear(190,260,$gearPitch,$teethDrive,$rs);
&printGear(181,231,$gearPitch,$teethDrive,$rs);
&printGear(106,367,$gearPitch,$teethDrive,$rs);

&braceB(192,14,0,12);
#&braceBH(172,60,0,8); # try living without this

### the 0.177" stock from the supplier in Tucson is an earnest 4.5mm thick...
#     This seems to be close enough to 4.7625 to support the wide forks
# on the hip and foot.  Cut some stackers to try this.
print "<desc>Stackers</desc><g transform=\"translate(214,5.5)\">";
  &stackerRow(6, 0,0);
  &stackerRow(6,10,1);
  &stackerRow(6,20,1);
  &stackerRow(4,30,1);
  &stackerRow(4,40,1);
  &stackerRow(4,50,1);
  &stackerRow(4,60,1);
  &stackerRow(4,70,1);
print "</g>\n";

print "<desc>spacers for motor mount</desc>\n";
local $ri = $rad4+0.5*$fuzz;
local $ro = 6;  # same radius as fork tyne on main bar
&roundSpacer(12,225,$ro,$ri);
&roundSpacer( 7,252,$ro,$ri);
&roundSpacer( 7,315,$ro,$ri);
&roundSpacer( 7,328,$ro,$ri);
&roundSpacer( 7,366,$ro,$ri);
&roundSpacer(13,377,$ro,$ri);
&roundSpacer(20,364,$ro,$ri);
&roundSpacer(26,377,$ro,$ri);
&roundSpacer(33,363,$ro,$ri);
&roundSpacer(39,377,$ro,$ri);

print "<desc>spacers for the B-brace bar, outside</desc>\n";
$ri = $irB + $fuzz; # a little loose
$ro = $orB;
&roundSpacer(164,375,$ro,$ri);
&roundSpacer(180,375,$ro,$ri);
&roundSpacer(181,359,$ro,$ri);
&roundSpacer(167,350,$ro,$ri);
&roundSpacer(170,302,$ro,$ri);

&roundSpacer(130,227,$ro,$ri);
&roundSpacer(157,227,$ro,$ri);
&roundSpacer(143,236,$ro,$ri);
&roundSpacer(188,208,$ro,$ri);
&roundSpacer(204,241,$ro,$ri);
&roundSpacer(220,242,$ro,$ri);
&roundSpacer(236,244,$ro,$ri);
&roundSpacer(287,244,$ro,$ri);
&roundSpacer(303,242,$ro,$ri);
&roundSpacer(319,241,$ro,$ri);
&roundSpacer(312,256,$ro,$ri);

print "</g></svg>\n"; # end of drawing
