# mill Y axis plate
# =================
# This is used to create yy.txt by macro expansion
# and that feeds into LibreCAD to do the drawing
# Start LibreCAD  File | New
# Click the 'three lines' icon in the Command: window  Load command file

# values copied from millYplate.scad
# { wide=200 }      // overall
# { deep=61 }
# { thick=4 }

# { screwD=33 }
# { screwX=35 }     // from Left
# { screwY=30 }     // from top
# { boltD=6 }       // M6
# { boltS=44.6 }    // bolt separation

# { beltC=98.14 }   // belt between centres
# { motorDY=5 }     // move motor up
# { motorX=screwX+sqrt(beltC*beltC-motorDY*motorDY) }
# { motorY=screwY+motorDY }
# { motorD=24 }
# { motorB=3 }      // M3
# { motorBS=30.6 }  // bolt separation

# { topcutX=109 }   // width of shallow TC
# { topcutX1=40 }   // how far from the screw can we stay high?

# end of copy

# outline
# =======
line;0,0;
{wide},0;
{wide},{deep};
{topcutX},{deep};
{topcutX},{deep-screwY};
{screwX+40},{deep-screwY};
{screwX+40},{deep-screwY+screwD/2-6};
{screwX+screwD/2},{deep-screwY+screwD/2-6};
{screwX+screwD/2},{deep-screwY};
k;
arc;{screwX+screwD/2},{deep-screwY};
{screwX},{deep-screwY-screwD/2};
{screwX-screwD/2},{deep-screwY};
k;
line;{screwX-screwD/2},{deep-screwY};
{screwX-screwD/2},{deep-screwY+screwD/2-6};
0,{deep-screwY+screwD/2-6};
0,0;
k;

# top of motor
# ============
# motor X { mx=motorX }
# motor Y { my=motorY }
# length of slots { slot=5 }
point;{mx-slot/2},{my};
# radius of slot { mr=12 }
arc;@0,-{mr};@-{mr},{mr};@{mr},{mr};
line;@0,0;@{slot},0;
arc;@0,0;@{mr},-{mr};@-{mr},-{mr};
line;@0,0;@-{slot},0;k

# XY offsets of bolt holes { bh=motorBS/2 }
# bolt radius { br=1.5 }

point;{mx-slot/2-bh},{my-bh};
arc;@0,-{br};@-{br},{br};@{br},{br};
line;@0,0;@{slot},0;
arc;@0,0;@{br},-{br};@-{br},-{br};
line;@0,0;@-{slot},0;k

point;{mx-slot/2+bh},{my-bh};
arc;@0,-{br};@-{br},{br};@{br},{br};
line;@0,0;@{slot},0;
arc;@0,0;@{br},-{br};@-{br},-{br};
line;@0,0;@-{slot},0;k

point;{mx-slot/2+bh},{my+bh};
arc;@0,-{br};@-{br},{br};@{br},{br};
line;@0,0;@{slot},0;
arc;@0,0;@{br},-{br};@-{br},-{br};
line;@0,0;@-{slot},0;k;

point;{mx-slot/2-bh},{my+bh};
arc;@0,-{br};@-{br},{br};@{br},{br};
line;@0,0;@{slot},0;
arc;@0,0;@{br},-{br};@-{br},-{br};
line;@0,0;@-{slot},0;k;

# bolts
# =====
ci;{screwX-boltS/2},{deep-screwY};@0,{boltD/2};k;
ci;{screwX+boltS/2},{deep-screwY};@0,{boltD/2};k;

# cover bolt
# ==========
ci;85,27;@0,2.5;k;

# grommet
# =======
ci;149,10;@0,6.5/2;k;

# cable gland
# ===========
ci;{wide-13},{deep/2};@0,19/2;k;

# junction block
# ==============
ci;170,{deep/2-15};@0,2;k;
ci;170,{deep/2+15};@0,2;k;

#finished
