Results 1 to 6 of 6

Thread: Circular Pocket Math Puzzle

  1. #1
    Registered
    Join Date
    Jul 2010
    Location
    USA
    Posts
    169
    Downloads
    0
    Uploads
    0

    Circular Pocket Math Puzzle

    Here's some psudo-code to cut a circular pocket:

    %
    O0001 (CIRCULAR_POCKET)
    (2.500 DIA., 0.568 DEPTH)
    G17 G40 G80

    (1.0 INSERT CUTTER - ROUGHING)
    G90 G54 G0 X-.45 Y0.
    S1250 M3
    G43 Z2. H1 T2
    Z.1
    G1 Z.1 F25.
    M8

    M98 P2

    G0 X-.45 Y0.
    Z-.0136
    G1 Z-.0136 F25.
    M98 P2

    G0 X-.45 Y0.
    Z-.1272
    G1 Z-.1272 F25.
    M98 P2

    G0 X-.45 Y0.
    Z-.2408
    G1 Z-.2408 F25.
    M982

    G0 X-.45 Y0.
    Z-.3544
    G1 Z-.3544 F25.
    M98 P2

    M30

    O0002 (1.0 INSERT CUTTER)
    G91 G3 X.9 Y0. Z-.0136 I.45 J0. F20.
    Z-.025 I-.45
    Z-.025 I-.45
    Z-.025 I-.45
    Z-.025 I-.45
    Z-.025 I-.45
    Z-.025 I-.45
    Z-.025 I-.45
    Z-.025 I-.45
    G90
    M99

    %

    It generates this:



    Here is what I can't figure out. The pocket is cut to 0.568 deep. The sub gets called 5 times, and .025 cuts are taken in incremental mode. The the last time the sub is called, the cutter is at 0.568.


    I'm trying to figure out the math so I can write incremental subs that step down in constant increments like this.

    The first time the sub is called, the first four blocks beginning with the G91 block just cut air. On the fifth block, cutting begins at -0.0136. In the remaining calls to the sub, the first four blocks beginning with the G91 block are overlap. Cutting resumes with the fifth block. For example, here are the values for the first pass through the sub:

    0.0864
    0.0614
    0.0364
    0.0114
    -0.0136
    -0.0386
    -0.0636
    -0.0886
    -0.1136

    Cutting begins at -0.0136. The value -0.0136 also appears in the main program as an absolute value, and in the sub as an incremental value.

    The crux of the matter is: Where does this -0.0136 value come from????? I'm actually traveling .668 in Z (beginning at Z.1). So I've tried a variety of dividing .668 by .025, etc., etc.

    I have noticed that .068/5 = .0136. Coincidence??? I can't figure out what to do with this information though, or how to write a similar sub for a depth of say .432, or how to factor in the overlapping blocks.

    I want to be able to write a sub in incremntal mode for this type of scenario, and know how to handle the difference left over after dividing by my cutting increment (say .025).

    I'm going to keep messing with this, but would love any suggestions.

    Thanks.....................


  2. #2
    Registered
    Join Date
    Jul 2005
    Location
    Canada
    Posts
    11,960
    Downloads
    0
    Uploads
    0
    Did you write this or get it from somewhere? One error is at the beginning in these lines:

    G43 Z2. H1 T2
    Z.1
    G1 Z.1 F25.
    M8

    M98 P2

    When the sub is called the tool is at Z.1 above the work so of course it has to make four circuits going down Z-.025 before it reaches the top of the work.

    Also some of the commands don't seem to make sense such as this:

    G0 X-.45 Y0.
    Z-.0136
    G1 Z-.0136 F25.

    The machine is in absolute and rapid mode from the G0X-.45 Y0. command so the next line Z-.0136 does a rapid move down to this position; the G1 Z-0.0136 does nothing because the tool is already at that position.


    Regarding this question:
    I want to be able to write a sub in incremntal mode for this type of scenario, and know how to handle the difference left over after dividing by my cutting increment (say .025).

    One way to do this is to start slightly above the surface so the final incremental pass is at the correct depth. Actually your code does this but it starts way too high and has a lot of unnecessary stuff.


    You want to go to a depth of 0.568 using 0.025 per pass. Diviiding 0.568 by 0.025 gives 22.72 passes. It is impossible to get .72 of a pass so you us 23 which would take you down to 0.575 which is 0.007 deeper than you want to go. So you start at Z+0.007 and go down 23 times 0.025 to finish at -0.568.

    Then you would need to do a final circuit without an Z value to remove the helical ramp at the bottom.
    An open mind is a virtue...so long as all the common sense has not leaked out.


  3. #3
    Registered
    Join Date
    Jul 2010
    Location
    USA
    Posts
    169
    Downloads
    0
    Uploads
    0
    Hey thanks for that suggestion. Simply starting the tool the remainder of the division above the part sounds like a good way to go.

    The code is just a portion of a part program from work. Mostly computer generated I suspect. I noticed several oddities also, but am just focused on the helical interpolation part. It does include a finish end mill as well. The value .0136 is obviously caluculated, and I was just kinda' curious about how it it came to be.

    Thanks for your suggestion, though.


  4. #4
    Registered
    Join Date
    Jul 2005
    Location
    Canada
    Posts
    11,960
    Downloads
    0
    Uploads
    0
    Here is where the 0.0136 comes from, at least the best I can figure it.

    The final sub program call has Z-.3544 for the starting position.

    The first line in the sub program does a half circuit moving down -0.0136 so now the tool is at Z-0.368 then it does 8 circuits at -.025 each for a final position of Z-0.568.

    But there is a whole lot of redundant nonsense in the code.
    An open mind is a virtue...so long as all the common sense has not leaked out.


  • #5
    Registered
    Join Date
    Jul 2010
    Location
    USA
    Posts
    169
    Downloads
    0
    Uploads
    0
    Thanks for your time, Geof.


  • #6
    Registered
    Join Date
    Jul 2010
    Location
    USA
    Posts
    169
    Downloads
    0
    Uploads
    0
    Amazing the difference sleeping on something can make.

    Using your thinking, Geof, here's why the Z-0.136 word is used 5 times (once for each sub program call).

    The code first makes 2 arbitrary decisions:

    1. the sub program will cut .100 deep in .025 increments.

    2. the sub program will be called 5 times.

    Given these arbitrary parameters, 5 executions of the sub program will get us to .500.

    That leaves us with .068 worth of depth unaccounted for.

    So, instead of following your thinking and just swiping it all off the top, it gets cut in .068/5 = .0136 increments.

    Each call to the sub program removes -.0136 + .100 = .1136 worth of material, x5 = .568.

    Simple.

    Thanks again for your time.


  • Similar Threads

    1. G12/G13 Circular pocket help needed
      By NeoMoses in forum G-Code Programing
      Replies: 9
      Last Post: 07-02-2012, 02:43 PM
    2. Newbie- Need help programming a circular pocket
      By Robert_Downs in forum Bridgeport and Hardinge Mills
      Replies: 6
      Last Post: 07-29-2010, 07:13 AM
    3. Circular Pocket Question
      By JayKayEh in forum CamWorks
      Replies: 4
      Last Post: 05-03-2010, 12:56 PM
    4. Need Help!- circular pocket
      By Darek833 in forum Okuma
      Replies: 8
      Last Post: 01-01-2010, 05:42 AM
    5. G77 Circular Pocket
      By Big John T in forum BobCad-Cam
      Replies: 3
      Last Post: 02-27-2007, 11:33 AM

    Posting Permissions


     


    About CNCzone.com

      We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

    Follow us on

    Facebook Dribbble RSS Feed


    Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.