(GenericKeywayForLCNC.ngc) (Cut a keyway in a bore with a vertical shaping tool) (Spindle is zeroed on the center of the bore) (Keyway is cut on the positive Y side) (2018 Clough42 - clough42.com) (For more information: https://youtu.be/cRve86xZbrw) (edited for Linuxcnc by freemoore - April 2021) (parameters) #<_key_width> = 6 #<_keyway_depth> = 2.794 #<_shaft_diameter> = 12.7 #<_cutter_width> = 4.52 #<_cutter_length_+y_from_spindle_center> = 10.175 #<_top_of_stroke> = 2 #<_bottom_of_stroke> = -2 #<_depth_of_cut_per_stroke> = 0.1 #<_x_spring_compensation> = 0.05 #<_y_spring_compensation> = 0.05 #<_plunge_feedrate> = 200 (calculated) #<_shaft_radius> = [#<_shaft_diameter> / 2] #<_half_of_key_width> = [#<_key_width> / 2] #<_x_offset> = [[#<_key_width> - #<_cutter_width>] / 2] #<_starting_y_position> = [SQRT[[#<_shaft_radius> * #<_shaft_radius>]-[#<_half_of_key_width> * #<_half_of_key_width>] - #<_cutter_length_+y_from_spindle_center>]] (Pythagorus FTW) #<_ending_y_position> = [#<_shaft_radius> + #<_keyway_depth> + #<_y_spring_compensation> - #<_cutter_length_+y_from_spindle_center>] #<_total_y_feed> = [#<_ending_y_position> - #<_starting_y_position> ] #<_number_of_loops> = [#<_total_y_feed> / #<_depth_of_cut_per_stroke> ] o repeat[#<_number_of_loops>] G0 Y# (move to Y position) G0 X[#<_x_offset> + #<_x_spring_compensation> ] (move X to one side) G1 Z#<_bottom_of_stroke> F#<_plunge_feedrate> (plunge) G0 Z#<_top_of_stroke> (retract) G0 X[0 - #<_x_offset> - #<_x_spring_compensation>] (move X to other side) G1 Z#<_bottom_of_stroke> F#<_plunge_feedrate> (plunge) G0 Z#<_top_of_stroke> (retract) # = [# + #<_depth_of_cut_per_stroke>] (increment Y position) o ENDREPEAT (main program) # = #<_starting_y_position> G0 X0 Y# (move to zero X and starting Y) G0 Z#<_top_of_stroke> (move Z to top of stroke) o call G0Z30 M2 %