I am not sure how I can put the code in Wiki.

I am releasing the following code under the GNU Public License:


(Makes a thread on a round part rotated in my fourth axis)
(Uses a 60 degree end mill)

O<thread_on_fourth_axis> sub
  #<x0>          = #1  (X0, left side)
  #<x1>          = #2  (X1, right side)
  #<y>           = #3  (Y, middle of the top edge of the round)
  #<z0>          = #4  (Z, top of the edge of the round)
  #<safez>       = #5  (Safe Z for rapids)
  #<zstep>       = #6  (Z Step, positive)
  #<spr>         = #7  (Step Per Revolution, Also determines Total Depth)
  #<depth>       = #8  (Depth of thread, positive, determined automatically
if 0 based on 60 degree thread.)
  #<diameter>    = #9  (Diameter of the round, needed for calculations of
feed rate)
  #<frate>       = #10 (feed rate based on surface speed)
  #<left_handed> = #11 (Set to 1 if left handed)

  #<rpm>                 = [#<frate>/3.1415/#<diameter>]
  #<horizontal_feedrate> = [#<rpm>*#<spr>]
  #<vertical_feedrate>   = [#<frate>/5]
  #<total_angle>         = [ 360 * [#<x1>-#<x0>]/#<spr> ]

  (Set negative total angle if left handed thread)
  O<if> if [#<left_handed> NE 0]
    #<total_angle> = [-#<total_angle>]
  O<if> endif

  O<if> if [#<depth> EQ 0]
    #<depth> = [#<spr>*1.73205/2] (depth = spr * sqrt 3 / 2 )
  O<if> endif

  O<withdraw> call [#<safez>]
  G0 A0 (go to 0 degree)

  G0 X[#<x0>] Y[#<y>] Z[#<safez>]

  ( Start drilling down to Z0, I could rapid,  )
  ( but slow is safer, will not break end mill )
  G1 Z[#<z0>] F[#<vertical_feedrate>]

  #<direction> = 1 (1 is right, 2 is left)

  #<z> = #<z0>

  O<loop> while [ 1 ]
    #<z> = [#<z> - #<zstep>]
    O<if> if [#<z> LT [#<z0> - #<depth>] ]
      #<z> = [#<z0> - #<depth>]
    O<if> endif

    G1 Z[#<z>] F[#<vertical_feedrate>]

    (Depending on direction, we go to X1 on the right and turn total_angle,)
    (or go to X0 on the left and go back to ZERO angle)

    O<if> if [#<direction> EQ 1 ]
      #<direction> = 0
      G1 X[#<x1>] A[#<total_angle>] F[#<horizontal_feedrate>]
    O<if> else
      #<direction> = 1
      G1 X[#<x0>] A0 F[#<horizontal_feedrate>]
    O<if> endif

    O<if> if [ #<z> LE [#<z0> - #<depth>] ]
      O<loop> break
    O<if> endif


  O<loop> endwhile

  O<withdraw> call [#<safez>]
  G0 X[#<x1>]

  G0 A0 (go to 0 degree)

O<thread_on_fourth_axis> endsub

M2



On Thu, Mar 21, 2013 at 10:46 AM, Gene Heskett <[email protected]> wrote:

> On Thursday 21 March 2013 11:44:24 Igor Chudov did opine:
>
> > Guys, I am extremely happy. I finally debugged my G code routine enough
> > that it works. I can make any thread, inch, metric, right hand, left
> > hand, whatever! It also can mill a very coarse thread in multiple
> > passes, reversing rotation every other pass (to return to A=0, as an
> > additional benefit).
> >
> > I can now make any bolt or threaded end I want!
> >
> > Thanks to all!
>
> That ought to be put in the wiki, Igor.  Can you?
>
> Cheers, Gene
> --
> "There are four boxes to be used in defense of liberty:
>  soap, ballot, jury, and ammo. Please use in that order."
> -Ed Howdershelt (Author)
> My web page: <http://coyoteden.dyndns-free.com:85/gene> is up!
> My views
> <http://www.armchairpatriot.com/What%20Has%20America%20Become.shtml>
> For courage mounteth with occasion.
>                 -- William Shakespeare, "King John"
> I was taught to respect my elders, but its getting
> harder and harder to find any...
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> Emc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/emc-users
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to