﻿# mill X axis plate
# =================
# This is used to create xx.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 millXplate.scad
# width { wide = 220 }
# height { deep=70 }
# thickness { thick=4 }
# { cutoutW=110 }
# { cutoutH=35 }
# { screwX=60 }
# { screwY=36 }
# { screwD=35 }
# { boltY=25 }      // bolt position
# { boltS=86 }      //      separation
# { boltD=6 }       // M6
# { beltC=98.14 }   // pully centres for 300mm belt
# { motorO=10 }     // motor offset below screw  <<<<<<<<< add 1.5mm please
#  motorX=screwX+(sqrt(beltC*beltC-motorO*motorO))
# { motorX=screwX+97.63 }
# { motorY=screwY-motorO }
# { motorB=3 }      // M3
# { motorBS=30.6 }  // bolt separation

# end of copy

# outline
# =======
line;0,{cutoutH};0,{deep};{wide},{deep};{wide},0;{cutoutW},0;{cutoutW},{cutoutH};k;
line;{cutoutW},{cutoutH};{screwX+screwD/2},{cutoutH};k
arc;{screwX+screwD/2},{cutoutH};{screwX},{screwY+screwD/2};{screwX-screwD/2},{cutoutH};k;
line;{screwX-screwD/2},{cutoutH};0,{cutoutH};k;
za;

# 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-boltY};@0,{boltD/2};k;
ci;{screwX+boltS/2},{deep-boltY};@0,{boltD/2};k;

# cover bolt
# ==========
ci;{wide-90},30;@0,{2.5};k;

# gland cavity
# ============
line;{wide-70},{deep-12-15/2};@0,15;@25,0;@0,-15;@-25,0;k;

# gland screws
# ============
ci;{wide-35},{deep-5};@0,3.4/2;k
ci;{wide-35},{deep-19};@0,3.4/2;k
ci;{wide-75},{deep-5};@0,3.4/2;k
ci;{wide-75},{deep-19};@0,3.4/2;k

# grommet hole
# ============
ci;125,55;@0,3.25;k;

# wiring block holes
# ==================
ci;{wide-25},13;@0,4/2;k
ci;{wide-25},43;@0,4/2;k

#finished
