[Home]SubroutineSample

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

 Code originally by jepler, converted to gcode by KennethLerman (lerman),
 fixed by jepler.

 This code will machine an approximation to a ellipse.
 (#1=xc #2=yc #3=xr #4=yr #5=subdiv #5=depth #7=rapid ht)
 o1000 sub
 (#10 = theta)
 (#11 = i)
 (#12 = x)
 (#13 = y)

 #14 = 360
 #11 = 1
 g0 x[#1+#3] y#2
 g0 z#6
 o1001 while [#11 LE #5]
   #10 = [#14 * #11 / #5]
   #12 = [#1 + [#3 * cos[#10]]]
   #13 = [#2 + [#4 * sin[#10]]]
   g1 x#12 y#13
   #11 = [#11 + 1]
 o1001 endwhile
 g0 z#7
 o1000 endsub
 (call it like this)
 f10
 o1000 call [0] [0] [1] [2] [200] [-1] [2]
 m2


LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions
Last edited December 11, 2005 7:30 am by KennethLerman (diff)
Search:
Published under a Creative Commons License