#!/usr/bin/perl -w
#
# drawing of some spare parts for 4.5mm stock, 200-crank config D walker
# 140122

$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';
require 'motorMount.pl';

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

local $br = $Brad + 0.5*$fuzz; # not quite press tight
local $y = 53;
local $x = 67;
&printMainFlat($x,$y     , 0 ,$Bx,$br,$Ay,$irA,4);
&printMainFlat($x,$y+16.7,180,$Bx,$br,$Ay,$irA,6);

## need two of these for each motor mount
$x = 8;
$y = 13;
local $ro = 6;
local $dx = 2*$ro+0.2;
local $ri = $rad4+0.5*$fuzz;
&roundSpacer($x,$y,$ro,$ri); $y += $dx;
&roundSpacer($x,$y,$ro,$ri); $y += $dx;
&roundSpacer($x,$y,$ro,$ri); $y-=4; $x=90;
&roundSpacer($x,$y,$ro,$ri); $x+=3; $y-=12;
&roundSpacer($x,$y,$ro,$ri); $x+=3; $y-=12;
&roundSpacer($x,$y,$ro,$ri); $x+=10; $y+=8;
&roundSpacer($x,$y,$ro,$ri); $x-=3; $y+=12;
&roundSpacer($x,$y,$ro,$ri);

local $rs = $irS - 0.2 * $fuzz;  # tight around #4-40 rod
&printGear(130,20,$gearPitch,$teethDrive,$rs);
$x = 33;  $y = 96;
local $dy = 27;
$dx = 5.5;
&printGear($x,$y,$gearPitch,$teethDrive,$rs);  $x-=$dx; $y+=$dy;
&printGear($x,$y,$gearPitch,$teethDrive,$rs);  $x-=$dx; $y+=$dy;
&printGear($x,$y,$gearPitch,$teethDrive,$rs);  $x+=$dy+3; $y-=$dx;
&printGear($x,$y,$gearPitch,$teethDrive,$rs);
&printGear(100,96,$gearPitch,$teethDrive,$rs);

&drawCrankArms(154,7,0,$AC,8,0);

### printing here for testing.  This should be on 3mm, while all else is 4.5
#&printMotorTabGA16(90,38.6,3,$rad4,6); # test alignment

#### draw other gear here for alignment/design testing.
# do not print this, for testing only.  This gear should be in 3mm
#&printGear(67,108.1,$gearPitch,$teethMotor,$rShaft,$dShaft);
#&plotCircle(67+13.7,108.1+3,3,15);

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