When in doubt, find code to steal. This Dutchmen (hence the unique spelling of circle) has a good explanation and subroutine. I improved it slightly to add vertical and circular feed rates as parameters, but also to make sure I understood gCode suroutines:
%
( Mill a hole with the centre at x,y and diameter d, diameter of mill Md and depth z )
( Parameters: x y d Md z vfeed cfeed)
( #1 #2 #3 #4 #5 #6 #7)
O100 sub
#8 = [#3 - #4] ( Diameter of circle to mill )
#8 = [#8 / 2] ( Radius of circle to mill )
G0 z 2 F #6
G0 x [#1 - #8] y #2
G1 z #5
G0 F#7
G17 G2 x [#1 - #8] y #2 i #8 j 0 z #5
O100 endsub
O100 call [2.75] [1.5] [1.5] [.5] [-.27] [5] [1]
(Clean up debris from circle)
O100 call [2.75] [1.5] [1.5] [.5] [-.27] [5] [20]
(remove inner circle )
G0 F 50 z 1
O100 call [2.75] [1.5] [1] [.5] [-.27] [5] [1]
(Clean up debris from circle)
O100 call [2.75] [1.5] [1] [.5] [-.27] [5] [20]
G0 F 50 z 1
%
Updated: No good reason to retract the cutting tool each time.
Conservative. Idaho. Software engineer. Historian. Trying to prevent Idiocracy from becoming a documentary.
Email complaints/requests about copyright infringement to clayton @ claytoncramer.com. Reminder: the last copyright troll that bothered me went bankrupt.
Showing posts with label CNC programming. Show all posts
Showing posts with label CNC programming. Show all posts
Saturday, June 25, 2016
Subscribe to:
Posts (Atom)