I am making the encoder mounting plates, on my manual mill, However, if I had a CNC mill, it would be easier. I was writing perl scripts to generate G codes, making some "building block" functions that perform common milling tasks. Their examples are "drilling with optional pecking", milling out a round through hole (also plunging by steps, not the whole depth), etc.
To see a drawing and specifications of encoder mounting plate, go here:
Just for the sake of fun, I wrote a script to generate G-Code to make encoder mounts from rectangular parts. It outputs 400 lines of G-code (also attached). I would not use this script, since I would already have made all encoder plates, so I wrote this script for entertainment. I will give it a try, however.
This is ALL untested, but as soon as I have a Z axis working, I will test it, at first various pieces separately. I will also add code to round the corners of the mounting plates instead of having them square in shape.
##################################################################### script #!/usr/bin/perl
use strict; use warnings;
use GCodeMacros;
g_wait_for_tool( 'Center Drill' );
g_set_clear_height( 0 );
# Start Motor Mounting Holes with center drill g_drill_rectangle_pattern( 0.629, 0.6915, 3.2459, 3.3084, -0.1, 5 );
# Start Encoder Mounting Holes with center drill g_drill_hole( 1.5811, 1.794, -0.1 ); g_drill_hole( 2.2938, 1.794, -0.1 ); g_drill_hole( 1.9375, 2.4115, -0.1 );
# Mill a hole for motor shaft, 17.02mm. g_wait_for_tool( '3/16 inch end mill' ); g_mill_through_hole( 1.9375, 2, 17.02/g_inch, -5/8, 3/16 );
# Drill Motor Mounting Holes g_wait_for_tool( '5/32 inch drill bit' ); g_drill_rectangle_pattern( 0.629, 0.6915, 3.2459, 3.3084, -5/8, 5, 0.1);
# Drill Encoder Mounting Holes g_wait_for_tool( '#43 drill bit' ); g_drill_hole( 1.5811, 1.794, -5/8, 0.1 ); g_drill_hole( 2.2938, 1.794, -5/8, 0.1 ); g_drill_hole( 1.9375, 2.4115, -5/8, 0.1 );
g_end;
###################################################################### G-Code (WAITING FOR TOOL: Center Drill) M0
(Drilling a rectangle: [0.629, 0.6915], [0.629, 3.3084]) (Drill a hole in [0.629, 0.6915] depth of -0.1.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X0.629 Y0.6915 ) G00 X0.629 Y0.6915
(Drilling) (Mill to: Z-0.1 at speed F5 ) G01 Z-0.1 F5
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [0.629, 3.3084] depth of -0.1.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X0.629 Y3.3084 ) G00 X0.629 Y3.3084
(Drilling) (Mill to: Z-0.1 at speed F5 ) G01 Z-0.1 F5
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [3.2459, 3.3084] depth of -0.1.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X3.2459 Y3.3084 ) G00 X3.2459 Y3.3084
(Drilling) (Mill to: Z-0.1 at speed F5 ) G01 Z-0.1 F5
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [3.2459, 0.6915] depth of -0.1.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X3.2459 Y0.6915 ) G00 X3.2459 Y0.6915
(Drilling) (Mill to: Z-0.1 at speed F5 ) G01 Z-0.1 F5
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [1.5811, 1.794] depth of -0.1.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X1.5811 Y1.794 ) G00 X1.5811 Y1.794
(Drilling) (Mill to: Z-0.1 at speed F10 ) G01 Z-0.1 F10
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [2.2938, 1.794] depth of -0.1.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X2.2938 Y1.794 ) G00 X2.2938 Y1.794
(Drilling) (Mill to: Z-0.1 at speed F10 ) G01 Z-0.1 F10
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [1.9375, 2.4115] depth of -0.1.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X1.9375 Y2.4115 ) G00 X1.9375 Y2.4115
(Drilling) (Mill to: Z-0.1 at speed F10 ) G01 Z-0.1 F10
(Returning to safe height) (Go to point Z0 ) G00 Z0
(WAITING FOR TOOL: 3/16 inch end mill) M0
(Mill Thru Hole) G17 (Go to point Z0 ) G00 Z0
(Go to point X2.51382874015748 ) G00 X2.51382874015748
(Step 1 -- go down by 0.1875) (Mill to: Z-0.1875 at speed F2 ) G01 Z-0.1875 F2
(Mill Circle starting from point [angle 0]. G2 X1.36117125984252 R0.57632874015748 G2 X2.51382874015748 R0.57632874015748 (Step 2 -- go down by 0.1875) (Mill to: Z-0.375 at speed F2 ) G01 Z-0.375 F2
(Mill Circle starting from point [angle 0]. G2 X1.36117125984252 R0.57632874015748 G2 X2.51382874015748 R0.57632874015748 (Step 3 -- go down by 0.1875) (Mill to: Z-0.5625 at speed F2 ) G01 Z-0.5625 F2
(Mill Circle starting from point [angle 0]. G2 X1.36117125984252 R0.57632874015748 G2 X2.51382874015748 R0.57632874015748 (Final step 4 -- go down to final depth -0.625) (Mill to: Z-0.625 at speed F2 ) G01 Z-0.625 F2
(Mill Circle starting from point [angle 0]. G2 X1.36117125984252 R0.57632874015748 G2 X2.51382874015748 R0.57632874015748 (Go to point Z0 ) G00 Z0
(WAITING FOR TOOL: 5/32 inch drill bit) M0
(Drilling a rectangle: [0.629, 0.6915], [0.629, 3.3084]) (Drill a hole in [0.629, 0.6915] depth of -0.625.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X0.629 Y0.6915 ) G00 X0.629 Y0.6915
(Drilling with pecking)
(Peck 1 -- drill, clear chips, go back) (Mill to: Z-0.1 at speed F5 ) G01 Z-0.1 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.1 ) G00 Z-0.1
(Peck 2 -- drill, clear chips, go back) (Mill to: Z-0.2 at speed F5 ) G01 Z-0.2 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.2 ) G00 Z-0.2
(Peck 3 -- drill, clear chips, go back) (Mill to: Z-0.3 at speed F5 ) G01 Z-0.3 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.3 ) G00 Z-0.3
(Peck 4 -- drill, clear chips, go back) (Mill to: Z-0.4 at speed F5 ) G01 Z-0.4 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.4 ) G00 Z-0.4
(Peck 5 -- drill, clear chips, go back) (Mill to: Z-0.5 at speed F5 ) G01 Z-0.5 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.5 ) G00 Z-0.5
(Peck 6 -- drill, clear chips, go back) (Mill to: Z-0.6 at speed F5 ) G01 Z-0.6 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.6 ) G00 Z-0.6
(Last drilling step) (Mill to: Z-0.625 at speed F5 ) G01 Z-0.625 F5
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [0.629, 3.3084] depth of -0.625.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X0.629 Y3.3084 ) G00 X0.629 Y3.3084
(Drilling with pecking)
(Peck 1 -- drill, clear chips, go back) (Mill to: Z-0.1 at speed F5 ) G01 Z-0.1 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.1 ) G00 Z-0.1
(Peck 2 -- drill, clear chips, go back) (Mill to: Z-0.2 at speed F5 ) G01 Z-0.2 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.2 ) G00 Z-0.2
(Peck 3 -- drill, clear chips, go back) (Mill to: Z-0.3 at speed F5 ) G01 Z-0.3 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.3 ) G00 Z-0.3
(Peck 4 -- drill, clear chips, go back) (Mill to: Z-0.4 at speed F5 ) G01 Z-0.4 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.4 ) G00 Z-0.4
(Peck 5 -- drill, clear chips, go back) (Mill to: Z-0.5 at speed F5 ) G01 Z-0.5 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.5 ) G00 Z-0.5
(Peck 6 -- drill, clear chips, go back) (Mill to: Z-0.6 at speed F5 ) G01 Z-0.6 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.6 ) G00 Z-0.6
(Last drilling step) (Mill to: Z-0.625 at speed F5 ) G01 Z-0.625 F5
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [3.2459, 3.3084] depth of -0.625.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X3.2459 Y3.3084 ) G00 X3.2459 Y3.3084
(Drilling with pecking)
(Peck 1 -- drill, clear chips, go back) (Mill to: Z-0.1 at speed F5 ) G01 Z-0.1 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.1 ) G00 Z-0.1
(Peck 2 -- drill, clear chips, go back) (Mill to: Z-0.2 at speed F5 ) G01 Z-0.2 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.2 ) G00 Z-0.2
(Peck 3 -- drill, clear chips, go back) (Mill to: Z-0.3 at speed F5 ) G01 Z-0.3 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.3 ) G00 Z-0.3
(Peck 4 -- drill, clear chips, go back) (Mill to: Z-0.4 at speed F5 ) G01 Z-0.4 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.4 ) G00 Z-0.4
(Peck 5 -- drill, clear chips, go back) (Mill to: Z-0.5 at speed F5 ) G01 Z-0.5 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.5 ) G00 Z-0.5
(Peck 6 -- drill, clear chips, go back) (Mill to: Z-0.6 at speed F5 ) G01 Z-0.6 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.6 ) G00 Z-0.6
(Last drilling step) (Mill to: Z-0.625 at speed F5 ) G01 Z-0.625 F5
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [3.2459, 0.6915] depth of -0.625.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X3.2459 Y0.6915 ) G00 X3.2459 Y0.6915
(Drilling with pecking)
(Peck 1 -- drill, clear chips, go back) (Mill to: Z-0.1 at speed F5 ) G01 Z-0.1 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.1 ) G00 Z-0.1
(Peck 2 -- drill, clear chips, go back) (Mill to: Z-0.2 at speed F5 ) G01 Z-0.2 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.2 ) G00 Z-0.2
(Peck 3 -- drill, clear chips, go back) (Mill to: Z-0.3 at speed F5 ) G01 Z-0.3 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.3 ) G00 Z-0.3
(Peck 4 -- drill, clear chips, go back) (Mill to: Z-0.4 at speed F5 ) G01 Z-0.4 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.4 ) G00 Z-0.4
(Peck 5 -- drill, clear chips, go back) (Mill to: Z-0.5 at speed F5 ) G01 Z-0.5 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.5 ) G00 Z-0.5
(Peck 6 -- drill, clear chips, go back) (Mill to: Z-0.6 at speed F5 ) G01 Z-0.6 F5
(Go to point Z0 ) G00 Z0
(Go to point Z-0.6 ) G00 Z-0.6
(Last drilling step) (Mill to: Z-0.625 at speed F5 ) G01 Z-0.625 F5
(Returning to safe height) (Go to point Z0 ) G00 Z0
(WAITING FOR TOOL: #43 drill bit) M0
(Drill a hole in [1.5811, 1.794] depth of -0.625.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X1.5811 Y1.794 ) G00 X1.5811 Y1.794
(Drilling) (Mill to: Z-0.625 at speed F0.1 ) G01 Z-0.625 F0.1
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [2.2938, 1.794] depth of -0.625.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X2.2938 Y1.794 ) G00 X2.2938 Y1.794
(Drilling) (Mill to: Z-0.625 at speed F0.1 ) G01 Z-0.625 F0.1
(Returning to safe height) (Go to point Z0 ) G00 Z0
(Drill a hole in [1.9375, 2.4115] depth of -0.625.) (withdraw to safe height) (Go to point Z0 ) G00 Z0
(go to starting point) (Go to point X1.9375 Y2.4115 ) G00 X1.9375 Y2.4115
(Drilling) (Mill to: Z-0.625 at speed F0.1 ) G01 Z-0.625 F0.1
(Returning to safe height) (Go to point Z0 ) G00 Z0
(The End!) M2