585,663 active members*
3,183 visitors online*
Register for free
Login
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2005
    Posts
    1662

    spiral macro ?

    Have one to share?

    I'm working on a code generator (in python) and finding it difficult to get a smooth loop in from center. A short example using a 1/2" EM with a target bore of 0.9" and a 0.1" stepover.

    From cam program
    Code:
    %
    G00 X0.0125 Y0 
    Z.1
    G01 Z-.1 F20
    G03 X-.0625 R.0375
    X.1125 R.0875
    X-.1625 R.1375
    x.1094 Y-.1674 R.1875
    X.2 Y0 R.2
    X-.2 R.2
    X.1094 Y-.1674 R.2
    G00 z2
    %
    Using my generator
    Code:
    %
    G00 X  0.0000 Y  0.0000 Z.1 
    G01 Z -0.1000 F3 
    G01 X  0.0250 F50 
    G03 X  0.0000 Y  0.0250 R  0.0250 
    X -0.0500 Y  0.0000 R  0.0312 
    X  0.0000 Y -0.0750 R  0.0563 
    X  0.1000 Y  0.0000 R  0.0813 
    X  0.0000 Y  0.1250 R  0.1063 
    X -0.1500 Y  0.0000 R  0.1313 
    X  0.0000 Y -0.1750 R  0.1562 
    X  0.2000 Y  0.0000 R  0.1813 
    X  0.0000 Y  0.2000 R  0.2000 
    X -0.2000 Y  0.0000 R  0.2000 
    X  0.0000 Y -0.2000 R  0.2000 
    X  0.2000 Y  0.0000 R  0.2000 
    X  0.0000 Y  0.2000 R  0.2000 
    G00 Z2 
    %
    The cam generated code blends the arcs, no awkward jogs.
    Anyone who says "It only goes together one way" has no imagination.

  2. #2
    Join Date
    Mar 2008
    Posts
    11
    In order to avoid 'jogs' when you change arcs, you need to make sure that the new radius is initially parallel to the old one. When you 'average' your radius, the machine moves the center of rotation to a place that you're not accounting for.

    I'm new to the CNC thing, but I'm trying to figure out how you get 0.9" bore with a 0.2" radius. spiral. Also, I'm assuming you don't really care about the feed rate.

    Let's assume, for a moment, that you're trying approximate a logarithmic spiral with final radius $R (at tool center) centered at 0,0 that goes out some $d per revolution. Here's some pseudocode for spiraling outward:

    Code:
    for(n=0; n*d<(R-d); n++) {
       x[0] y[d*n+d/4] R[d*n+/4]
       x[n*d+2/4] y[-d/4] R[d*n+2d/4]
       x[-d/4] y[d*n-3/4] R[d*n+3/4]
       x[-d*n-5*d/4] y[0] R[d*n+4*d/4]
    }
    You'll need a little bit of massaging to make it start and finish smoothly.

  3. #3
    Join Date
    Mar 2005
    Posts
    988
    ... but I'm trying to figure out how you get 0.9" bore with a 0.2" radius.
    With a 1/2" endmill....just like he said in his post... And his feed is already set at "50". Keep in mind that most machines and controls only resolve to 4 places on the decimal. Within a macro, you can resolve to 8 (thats 8 places total inluding whole numbers) but machine will still round to 4.
    It's just a part..... cutter still goes round and round....

  4. #4
    Join Date
    May 2005
    Posts
    1662
    Quote Originally Posted by NateTG View Post
    You'll need a little bit of massaging to make it start and finish smoothly.
    Finishing smoothly is np. The ugliness is in the first 180 degrees, maybe from a poor choice of starting point. The CAM examples I've found cheat a true spiral by by starting x= "some distance from true center".

    Thanks for the reply. Will test that out that math if my brain can decipher it. Formal education was many years ago LOL.

    btw: EM is shop shorthand for endmill. Probably what threw you off.
    Anyone who says "It only goes together one way" has no imagination.

  5. #5
    Join Date
    Mar 2008
    Posts
    11
    Quote Originally Posted by cyclestart View Post
    Finishing smoothly is np. The ugliness is in the first 180 degrees, maybe from a poor choice of starting point. The CAM examples I've found cheat a true spiral by by starting x= "some distance from true center".
    Imagine you've got a square peg where one of the corners is on the center of the circle, and you're unwinding a string from the square peg. Every time that you unwind around a corner, your radius is going to change, but the two centers of rotation are going to be in line with each other (along the string).

Similar Threads

  1. Drawing a spiral?
    By m1911bldr in forum BobCad-Cam
    Replies: 1
    Last Post: 02-05-2008, 07:51 PM
  2. Convert Fanuc Macro to Fadal Macro
    By bfoster59 in forum Fadal
    Replies: 1
    Last Post: 11-09-2007, 06:41 AM
  3. Spiral saw RPM
    By nophead00 in forum MetalWork Discussion
    Replies: 2
    Last Post: 04-22-2007, 09:43 AM
  4. 2D contouring with spiral
    By Alan L in forum Hypermill
    Replies: 0
    Last Post: 12-31-2006, 02:53 AM
  5. The magical spiral
    By paul3112 in forum G-Code Programing
    Replies: 3
    Last Post: 08-06-2006, 03:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •