588,033 active members*
5,605 visitors online*
Register for free
Login
Results 1 to 16 of 16
  1. #1
    Join Date
    Feb 2011
    Posts
    0

    automatic calculation of fixture offsets

    I want the control to calculate fixture offsets for me by using macros (fanuc macro B). I'm not quite sure how to write the formula for this.

    What I have is a horizontal machining center with a rotary B-axis. I want to manually enter the X-axis and Z-axis numbers (for the work offsets) at B0 (G54), then run the program and have the formula in the program enter in the rest of the work offsets at the other B-axis angles.

    For instance, if I entered in ".0500" for X-axis and "9.0000" for Z-axis, the offsets at B180.000 would be just the opposite signs (-.0500 & -9.0000, respectively). That would be easy enough to write. But I need the formula to be able to calculate at "odd" B-axis angles, like say 103.250 (The answers would be X-8.7719, Z-2.0141), using trigonometry.

    So for an example, if I had a G54 (B0) offset with the X & Z-axis numbers given (I enter and these numbers represent distance from c/l of index), I would want to calculate for the X & Z-axis numbers for G55 (@B103.250). I would want the formula to consider what is in the G54 X & Z work offsets (#5221 & #5224), then calculate for the new X & Z work offsets based on what's in the B-axis offset for G55 (#5246), and automatically enter in the table.

    I hope I explained that well enough.

    Any help is appreciated....

  2. #2
    Join Date
    Aug 2011
    Posts
    2517
    not really enough info. It can get quite complex.
    However you seem to have worked out most of it yourself.
    you can use SIN/COS/TAN in macros.
    #1 = SIN[103.123]
    #5221 = 945.567 - #1

    (or whatever you want to calculate)

  3. #3
    Join Date
    Feb 2011
    Posts
    0
    This is what I have so far:

    for the X-axis offset:
    #5241=[COS[42]*[#5221]-[#5224*SIN[42]]] (Answer is -5.9850)

    and for Z-axis:
    #5244=[#5221*SIN[42]+[#5224]*COS[42]] (Answer is 6.7218)

    The only thing is the order of operations - I'm not sure how to write it so it does what I want to do in order. Can anyone give me a brief explanation of use of the brackets??

    Thanks....

  4. #4
    Join Date
    Jul 2003
    Posts
    1220
    See Post #6

  5. #5
    Join Date
    Aug 2011
    Posts
    2517
    in general programming terms calculate the inner brackets first then move out to the next bracket pair and do that calculation. you may need to remember some numbers then apply them at the end. when using brackets there must be a pair of brackets for each calculation.

    example....
    a = (1+(2*3))*4

    the answer is calculated as
    2*3 = 6
    then 1+6 = 7
    then 7 *4
    so a = 28

    you really should google for an explanation on this. it's basic maths.
    'Order Of Operations'
    here's one example....
    Order of Operations

  6. #6
    Join Date
    Jul 2003
    Posts
    1220
    #5241 = [#5221 * Cos[42]] - [#5224 * Sin[42]]
    #5244 = [#5221 * Sin[42]] + [#5224 * Cos[42]]

  7. #7
    Join Date
    Feb 2011
    Posts
    0
    Thanks your your help...much appreciated.

  8. #8
    Join Date
    Aug 2009
    Posts
    684
    If you have many work offsets per operation, and a limited amount of work offsets, you may want to consider making your macro an integral part of your standard programming format.

    For example, you put your original origin in G54 and your macro calculates each new position as the B-axis indexes in the main program, overwriting the 'temporary' offset position (eg G59) with every process.

    Keeps things tidier, especially when running multiple pallets and/or if offsets need to be re-established for each part.

    DP

  9. #9
    Join Date
    Feb 2011
    Posts
    0
    Sounds interesting but I'm not getting it completely. Could you elaborate?

    Thanks

  10. #10
    Join Date
    Aug 2009
    Posts
    684
    Once you have your macro program formulae working correctly, assign a G-code to it and use it in your program instead of work offset calls. The B-AXIS ROTATION, work offset overwrite, and subsequent work offset call (G59 say), will always be in the macro program. This method means you only need to store one offset for each job and leave the G59 as your 'running' offset.

    All the sequences in my main programs look like this: -

    N5 (Operation)
    G123 D1 R0 <------------- Call setup macro, defining the Datum to rotate by R
    T# M6
    S# M3
    blah
    blah
    blah
    M1

    I use the extended work offsets (G54.1 P1 - P47) to define my original datum and P48 is the ALWAYS the offset that is written to (and called) by G123 BEFORE returning to the main program.

    This means I can tweak my original offset if required and start without fear from any sequence number in the program.

    Now that this format is standard, I have built so much more into G123 than simply offset calcs; eg safety retract based on workpiece/tool length, pallet load based on offset number, even skipping the current sequence entirely if required (eg multiple part fixture without a full complement of parts..).

    DP

  11. #11
    Join Date
    Feb 2011
    Posts
    0
    That is definitely cool and some very good ideas. Would you be willing to share seem "complete" examples? (Willing to share the entire code of something so I can wrap my head around it)

  12. #12
    Join Date
    Aug 2009
    Posts
    684
    Have attached a flowchart showing all the tasks my setup macro is responsible for. We can discuss any particular function you are interested in, in more detail if you wish.

    How much of that lot you would want to adopt would depend on your control and your needs (unnecessary automation can be bad), as well as how much discipline you want to impose on your programming format.

    My suggestion is to integrate one thing at a time, once you have decided it is necessary and have a fairly fool-proof way of working it in to your method. That is how my macro evolved, always taking into account that others will have to follow what you have done and must also reap the benefits - otherwise there may be some justified resistance...

    DP
    Attached Thumbnails Attached Thumbnails G123.jpg  

  13. #13
    Join Date
    Jun 2008
    Posts
    20
    Hi,

    I know this is an old thread, but you may be still interested in this problem. You can check CNC Offset Calculator - it's a program that does the calculation of offsets on HMC. It calculates the values of X,Y,Z coordiantes or makes a program for CNC control using system variables and the CNC control calculates offset values dynamically when it runs. There are three versions available - Pro, Light and Ultra Light.
    You can dowload trial versions from AdaptiveCNC.com.
    There is also the formula for calculating offsets if you can write your own program.

    Regards,
    ZedB

  14. #14
    Join Date
    Feb 2011
    Posts
    0
    Well, it's been about 10 months since I started this thread ... I thought I'd give an update. (I gave an update on another site regarding this exact same topic so I figured I do the same here).

    I've since developed a helpful excel spreadsheet for automatic dynamic fixture offset calculation. I did this primarily to correctly and efficiently calculate the X-axis and Z-axis work offsets at "odd" (i.e. hard to figure) B-axis programmed positions on horizontal machining centers (the spreadsheet can also be used for A-axis rotary devices on Vertical Machining Centers). Performing these calculations "on the fly" with just your memory, a calculator, pencil and pad of paper during a set-up on the factory floor proves to be a time-consuming and error-prone process that this spreadsheet was meant to alleviate. I have also created "machine-specific" spreadsheets, so in one excel file, every machine in the shop is assigned a tab and all the necessary information to automatically and correctly calculate all the work offsets needed for any given machine is there.

    I have also incorporated my formula into macros in my G-code programs where, at the most, all the operator has to enter are the relevant X-axis and Z-axis values at B0 and the macro automatically calculates and enters the correct values in the correct locations in the machine's control. However, most of the time, I have the programs set-up to utilize a probe and the positions it finds are used to correctly and automatically calculate and enter every necessary linear work offset at every programmed B-axis angle in the control, without operator intervention at all in this matter. So, where your probing cycle can enter the direct values it probes into the work offset number (S0 = G54, etc) of your choice, my macros go a few steps further for the remaining work offsets. So, no need to bring out the trig book and calculator and no need to worry if your numbers are correct. No need to worry about physically entering (typing) the wrong numbers into the control. This has proved to save many hours of set-up time in our shop as very few people in our shop were able to do these calculations manually in the first place. With most, if not all of these steps automated, set-up scrap levels have been reduced while set-up productivity has improved. The greatly improved confidence the new-job set-up people have in the work offset values that are automatically calculated for them give them a lot less to worry about. I have done this for the Fanuc Macro-B programming language machines in our shop as well as the K & T's APL (Advanced Programming Language).

    It's been over 10 months since I started this quest regarding automatic dynamic fixture offset calculation, and I have learned a lot. It wasn't necessarily difficult, but I have worked many hours on the spreadsheets and as I look at what I have created I wonder how come it took so long to develop lol and why I waited so long to develop it. The results have been very helpful to me and my shop and I will continue to improve on what I've done.

  15. #15
    Join Date
    Aug 2009
    Posts
    684
    Have similarly edited probing cycles to alter the 'Original' work offset correctly, based on last called values and current pallet/rotational position. Took some proving out.

    Have also put in quite a few safety checks to ensure that no incorrect setting occurs, ie you must be at the last defined rotation with correct pallet and P48 still active, otherwise it pulls me up in a way that is really quite spooky...after a brief internalised snort of indignation, I meekly type in my macro call with the updated info and repeat the process.

    DP

  16. #16
    Join Date
    Feb 2011
    Posts
    0
    Yeah, and now that I've created the spreadsheets and some macros, I've been made aware of others that are SELLING basically the same thing, and for what I would call big bucks! Maybe I should get in on that lol. If I knew of their existence before I made my own, I probably would have spent the money on at least one of them, though. Very well worth it, especially if you aren't a trig whiz or just simply don't understand how to calculate and assign the correct work offsets, etc. etc.

Similar Threads

  1. Fixture Offsets
    By Jerseycnc in forum Fanuc
    Replies: 12
    Last Post: 01-23-2012, 06:49 PM
  2. FIXTURE OFFSETS
    By 1234567 in forum Cincinnati CNC
    Replies: 2
    Last Post: 11-18-2011, 04:15 PM
  3. Fixture offsets, X3
    By KevinV_MEI in forum Mastercam
    Replies: 2
    Last Post: 02-06-2011, 05:04 PM
  4. Z Fixture offsets
    By gbpacker in forum Fadal
    Replies: 13
    Last Post: 09-02-2009, 09:41 PM
  5. fixture offsets
    By beartrax in forum G-Code Programing
    Replies: 1
    Last Post: 11-15-2008, 01:19 AM

Posting Permissions

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