# mill Z axis top plate
# =====================
# This is used to create millx.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

# outline
# =======
# width  { wide = 175 }
# height { high=125  }
line;0,0;{wide},0;{wide},{high};0,{high};0,0;k;
za;

# top of motor
# ============
# motor X { mx=35 }
# motor Y { my=35 }
# length of slots { slot=5 }
point;{mx-slot/2},{my};
# radius of slot { mr=19.5 }
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=23.7 }
# bolt radius { br=2.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

# top of screw
# ============
# belt between centres { belt=98.14 }
# Y displacement of centres { ay=50.0 }
# X displacement of centre { ax=84.45 }
# spacing of 'front' bolts { b=78.0 }
# spacing of 'rear' bolts  { c=63.8 }
k;
# 40mm diam main hole
ci;{mx+ax},{my+ay};@0,{40/2};k;
# displace 'rear' holes 23.5mm
ci;@-{c/2},-23.5;@0,{8/2};k;
ci;@{c},0;@0,{8/2};k;
# front holes 50.5mm from rear
ci;@{(b-c)/2},50.5;@0,{8/2};k;
ci;@-{b},0;@0,{8/2};k;

# cover bolt
# ==========
ci;{wide-75},35;@0,5/2;k;

# cable gland
# ===========
ci;{wide-18},18;@0,20/2;k;

# cable grommet
# ===========
ci;80,30;@0,6.5/2;k;

# cable clip screws
# =================
ci;{wide-51},30+15;@0,2;k;
ci;{wide-51},30-15;@0,2;k;

#finished

