#!/usr/bin/perl -w
# $URL: svn+ssh://mrwhat@ssh.boim.com/home/mrwhat/svn/Walker/trunk/lc20_30_P2.pl $
# $Id: lc20_30_P2.pl 364 2014-01-24 16:27:16Z mrwhat $
#
# script to draw thin Jansen walker parts 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 = 384;  # width of drawing, pixels?!?? -- most programs seem to ignore units, use mm
$hPx = 384;  # height of drawing, pixels?!??

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

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

&printPayloadBotEnds(174,50.8,90);
&printPayloadLid(279.6,0.2,90);

&drawEFgroup(10,142,0); ### EF
&drawBHgroup(292.3,8,0); ### BH
&drawBEDforkGroup(7,40,0,8); ### forks for CD on BED, need a total of 8
&drawWideForkGroup(188,201,0,$irB,8); ### B-forks for BED, and H-forks for foot

# back brace tabs for motor mounts
#&drawMotorMountPair(147,20,90);
local $ri = $rad4 + 0.5*$fuzz;
&printMotorTabGA16(142, 12, 0 ,3,$ri,6);
&printMotorTabGA16(247,371,180,3,$ri,6);
&printMotorStacker(104,42,180,$ri);
&printMotorStacker(144,36,  0,$ri);

# move to 2mm?
=begin comment
print "\n<desc>Outer plates for drive gear</desc>\n";
local $x0 = 347;
for (local $i=0;$i<4;$i++){
    local $yy = 144+$i*2*($drivePlateOR+.15);
    &roundSpacer($x0,$yy,$drivePlateOR,
                 $irA-$fuzz*.3); # let plates be tight on A-axle standoffs

    # make some light-engraved guide lines for bevel
    # motor gear outer radius is 15.9
    local $motorGearOR=16;
    print "<g transform=\"translate($x0,$yy)\">
<path stroke='rgb(255,0,255)' d='";
    &drawCircle(0,0,$motorGearOR,36);
    print "'></path></g>\n";
}
=end comment
=cut

## motor gears, at least two, perhaps some spares?
&printGear(286,264,$gearPitch,$teethMotor,$rShaft,$dShaft);
#&printGear(345,265,$gearPitch,$teethMotor,$rShaft,$dShaft);
&printGear(210,338,$gearPitch,$teethMotor,$rShaft,$dShaft);
&printGear(270,330,$gearPitch,$teethMotor,$rShaft,$dShaft);

# move to 4.5mm ? --> &braceBH(250,288,0,8);

# current design needs 16 3mm stackers. One on each BED and foot
print "<g transform=\"translate(0,5.3)\">";
for (local $i=0; $i<3;$i++) { &stackerRow(6,10*$i,$i?1: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
