#!/usr/bin/perl -w
# $URL: svn+ssh://mrwhat@ssh.boim.com/home/mrwhat/svn/Walker/trunk/XE20_45_344x384.pl $
# $Id: XE20_45_344x384.pl 414 2014-03-13 16:31:15Z mrwhat $
#
# script to draw thick Jansen walker parts for laser cutting in SVG
#    This version is for 3/16" standoff hinges, with standoff axle and crank-arm
# Jansen configuration E
$preview = 0;  # Always a preview now.  Hand edit .svg, make thin pitch, for production

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(130,269,70);   ##### feet  -- $FH $GH $FG $FGleft $FGperp 
&drawBEDoct(287,300,135);    ### BED
&printMainQuadFlat(257,50.5,0);

#&drawCrankArms(302,40,0,$AC,8);  ### AC, need only 4, but cutting spares
&drawCrankArms(230,13,90,$AC,4);  ### AC, need only 4
&drawCrankArms(320,13,90,$AC,4);  #   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( 88,236,$gearPitch,$teethDrive,$rs);  # only need 2, but cutting spares
&printGear(178,366,$gearPitch,$teethDrive,$rs);
&printGear(162,237,$gearPitch,$teethDrive,$rs);
&printGear(102,367,$gearPitch,$teethDrive,$rs);

#&braceB(300,155,10,12);
&braceB(193,157,0,8);
&braceB(219,195,0,5); # one spare

#&braceBH(172,60,0,8); # try living without this

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
local $x0 = 7+1;
local $y0 = 279+1;
local $d = 12.5;
&roundSpacer($x0,$y0,$ro,$ri);   $y0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $y0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $y0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);
$y0 = 355-5;
local $x1 = 14;
local $x2 = $x1-7;
local $d1 = 11;
$x0 = $x2;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $y0 += $d1;
$x0 = $x1-1;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $x0  = $x2;  $y0 += $d1;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);

print "<desc>spacers for the B-brace bar, outside</desc>\n";
$ri = $irB + $fuzz; # a little loose
$ro = $orB;
$y0 = 375;
$x0 = 199;
$d = 16;
$d1 = 13.5;
&roundSpacer(299,$y0,$ro,$ri);
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 += $d;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 -= $d/2; $y0 -= $d1;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 -= $d;
&roundSpacer($x0,$y0,$ro,$ri);

$x0 = 335.5;
$y0 = 358;
&roundSpacer($x0,$y0,$ro,$ri);   $y0 -= $d;
&roundSpacer($x0,$y0,$ro,$ri);   $y0 = 298;
&roundSpacer($x0,$y0,$ro,$ri);   $y0 = 270;
&roundSpacer($x0,$y0,$ro,$ri);   $x0 -= 50;
&roundSpacer($x0,$y0,$ro,$ri);

### 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(264,260) rotate(-90)\">";
  &stackerRow(3, 0,2);
  &stackerRow(3,10,2);
  &stackerRow(3,20,2);
  &stackerRow(5,30,2);
  &stackerRow(5,40,2);
  &stackerRow(5,50,2);
  &stackerRow(5,60,2);
  &stackerRow(5,70,0);
print "</g>\n";

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