586,047 active members*
3,896 visitors online*
Register for free
Login
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Posts
    258

    macro program for work offset

    I have been going back and forth with a few guys on another topic on four axis programming. They were talking about using a macro to calculate the position of part position. Now they did it, they made me think:idea: I am working on a post for a machine we have here in our shop. This controller is a "FAPT" control and will not allow "G54.1". I need to program my angle holes on the parts from the centerline "X, Z". I need to use "G10's" to do this. I need to shift my "G54, G55" back and forth to get this done as that the remaining work on the parts are done on the face of the part. I was working on my post to use a "G10" shift line to go from the centerline to the face of the part. The problem with this is everytime the shift takes place the is a "G10" line. When they need to adjust the work offsets, they need to change all of them. If they forget then they can scrap parts. I want to build a macro to control this. The first macro will be controlled by the system variable for "G54, G55 Z". The other macro will just be the distance from the spindle face to the center line of the "B axis" Does anyone have either the macro to do this or a list of system variables so I can build these macros? I have built some simple macros for the machines allready so I have a general understanding of what I need to do.

    TIA

    TIA

  2. #2
    Join Date
    Nov 2005
    Posts
    274
    Quote Originally Posted by cncwhiz View Post
    I have been going back and forth with a few guys on another topic on four axis programming. They were talking about using a macro to calculate the position of part position. Now they did it, they made me think:idea: I am working on a post for a machine we have here in our shop. This controller is a "FAPT" control and will not allow "G54.1". I need to program my angle holes on the parts from the centerline "X, Z". I need to use "G10's" to do this. I need to shift my "G54, G55" back and forth to get this done as that the remaining work on the parts are done on the face of the part. I was working on my post to use a "G10" shift line to go from the centerline to the face of the part. The problem with this is everytime the shift takes place the is a "G10" line. When they need to adjust the work offsets, they need to change all of them. If they forget then they can scrap parts. I want to build a macro to control this. The first macro will be controlled by the system variable for "G54, G55 Z". The other macro will just be the distance from the spindle face to the center line of the "B axis" Does anyone have either the macro to do this or a list of system variables so I can build these macros? I have built some simple macros for the machines allready so I have a general understanding of what I need to do.

    TIA

    TIA

    Like This ???????? It calculates position at an angle from the X Z position on the Fixture.

    :8701(MOVE SIDE)
    (SIDE B)
    #150=710.-ABS[#5223]
    (SIDE C)
    #151=ABS[#5221]
    (ANGLE THETA)
    #152=[ATAN[#150]/[#151]]-11.000(ANGLE)
    (SIDE A)
    #153=SQRT[[#150*#150]+[#151*#151]]
    (NEW SIDE B)
    #154=#153*[SIN[#152]]
    (NEW SIDE C)
    #155=#153*[COS[#152]]
    (X AXIS ADJ)
    #156=#155-#151
    (Z AXIS ADJ)
    #157=#150-#154
    #528=ABS[#156]
    #529=ABS[#157]
    G91
    G10L2G54P01X#528Y0.0Z-#529 (LOAD WORKSHIFT)
    G90
    #150=#0
    #151=#0
    #152=#0
    #153=#0
    #154=#0
    #155=#0
    #156=#0
    #157=#0
    M99
    :8702(RETURN FACE)
    G91
    G10L2G54P01X-#528Y0.0Z#529(CLEAR WORKSHIFT)
    G90
    #525=2
    #528=#0
    #529=#0
    M99
    :8703(MOVE @ LEFT)
    (SIDE B)
    #150=710.-ABS[#5223]
    (SIDE C)
    #151=ABS[#5221]
    (ANGLE THETA)
    #152=[ATAN[#150]/[#151]]-11.000(ANGLE)
    (SIDE A)
    #153=SQRT[[#150*#150]+[#151*#151]]
    (NEW SIDE B)
    #154=#153*[SIN[#152]]
    (NEW SIDE C)
    #155=#153*[COS[#152]]
    (X AXIS ADJ)
    #156=#155-#151
    (Z AXIS ADJ)
    #157=#150-#154
    #528=ABS[#156]
    #529=[#157]
    G91
    G10L2G54P01X-#528Y0.0Z-#529(LOAD WORKSHIFT)
    G90
    #150=#0
    #151=#0
    #152=#0
    #153=#0
    #154=#0
    #155=#0
    #156=#0
    #157=#0
    M99
    :8704(RETURN @ LEFT)
    G91
    G10L2G54P01X#528Y0.0Z#529(CLEAR WORKSHIFT)
    G90
    #525=2
    #528=#0
    #529=#0
    M99

  3. #3
    Join Date
    Jan 2004
    Posts
    258
    That is cool macro. Are you using the center of the tonbstone to calculate the angle? The is missing sides to the angles to calculate? Also lets say that my part is 10 inches from the center line. When it rotates, this is not a typical right triangle? The do you canculate this? The rotation is actually a for lack of better words a radial tringle? Also how do you set your tool offsets and "Z" plane? Do you calculate from gage line zero? You reset all of your values so where are your known distances or missing sides of the triagle?

  4. #4
    Join Date
    Nov 2005
    Posts
    274
    Quote Originally Posted by cncwhiz View Post
    That is cool macro. Are you using the center of the tonbstone to calculate the angle? The is missing sides to the angles to calculate? Also lets say that my part is 10 inches from the center line. When it rotates, this is not a typical right triangle? The do you canculate this? The rotation is actually a for lack of better words a radial tringle? Also how do you set your tool offsets and "Z" plane? Do you calculate from gage line zero? You reset all of your values so where are your known distances or missing sides of the triagle?
    Here is a whole exsample i have the Main goemetry and the calc subs,Just follow it in and out and you should be able to figure it out

    Bluesman
    Attached Files Attached Files

  5. #5
    Join Date
    Dec 2005
    Posts
    55
    Cncwhiz,

    I program like this all of the time. We have horizontal machines so you might need to change this around a bit. Also, I do use G54.1P1 but there is nothing to say you can't use G54 to G59 for this.

    %
    :0002(PALLET A)
    #149=0(THIS TELLS THE CONTROL TO READ PALLET A COORDS)
    M98P1000
    M30

    :0003(PALLET B)
    #149=1 (THIS TELLS THE CONTROL TO READ PALLET B COORDS)
    M98P1000
    M30

    :1000(2342 ALL MAIN)
    (2342A&B REVD)
    (2342C REVE)
    (15NOV07 JK)
    (LAST RUN 15NOV07)
    (0M0S)
    (DO NOT ADJUST ANY X OR Y)
    (VALUES IN MAIN PROGRAM)
    G0G17G40G80
    G90G94G98
    G91G28Z0
    M1(DRILL LONG PORT)
    G0G17G40G80
    G90G94G98
    T1M6(S2342-6)
    B90.
    M98P1100
    S3500M3
    G54.1P1X0Y0M8
    G43Z1.2H1T2
    G81Z-1.143R.1F18.
    G54.1P2X0Y0
    G80G0Z2.5
    G54.1P4X0Y0
    Z1.2
    G81Z-1.143R.1
    G54.1P3X0Y0
    G80G0Z6.M9
    G91G28X0Y0M29
    M1(DRILL SHORT PORT)
    G0G17G40G80
    G90G94G98
    T2M6(S2342-5)
    B270.
    M98P1100
    #502=0(THIS IS THE SIGNED DISTANCE FROM THE X DATUM OF THE PART)
    #503=-2.09(THIS IS THE SIGNED DATUM FROM THE Z VALUE OF THE PART)
    M98P1200
    S3500M3
    G54.1P3X-.562Y0M8
    G43Z1.H2T3
    G81Z-.66R.1F18.
    G54.1P4X-.562Y0
    G80G0Z2.5
    G54.1P2X.562Y0
    Z1.
    G81Z-.66R.1
    G54.1P1X.562Y0
    G80G0Z6.M9
    G91G28X0Y0M29
    M1(1/4-18 NPT)
    G0G17G40G80
    G90G94G98
    T3M6(LAKESHORE 18NPT TRML)
    (D23)
    B270.
    M98P1100
    #502=0
    #503=-2.09
    M98P1200
    S8000M3
    G54.1P1X.562Y0M8
    G43Z1.2H3T4
    M98P1400
    G54.1P2X.562Y0
    M98P1400
    G0Z2.5
    G54.1P4X-.562Y0
    M98P1400
    G54.1P3X-.562Y0
    M98P1400
    G0Z3.
    B90.
    M98P1100
    G54.1P1X0Y0
    M98P1400
    G54.1P2X0Y0
    M98P1400
    G0Z2.5
    G54.1P4X0Y0
    M98P1400
    G54.1P3X0Y0
    M98P1400
    G0Z7.M9
    G91G28X0Y0M29
    M1(FACE)
    G0G17G40G80
    G90G94G98
    BLAH, BLAH, BLAH..........

    :1100(2342 ALL 90 COORDS)
    #501=90.(THIS IS THE ANGLE FROM ZEOR ON THE AXIS TO WHERE YOUR PARTS ARE)
    #101=-9.921(THIS IS THE DIST FROM MACHINE ZERO TO THE CENTERLINE OF ROTATION IN X)
    #102=-20.4725(THIS IS THE DIST FROM MACHINE ZERO TO THE CONTERLINE OF ROTATION IN Z)
    IF[#149GT0]GOTO10
    (PALLET A)
    (G54.1P1 LEFT TOP)
    G10L20P1X-14.149Y-7.854Z-19.552
    (G54.1P2 LEFT BOTTOM)
    G10L20P2X#7001Y-11.522Z-19.552
    (G54.1P3 RIGHT TOP)
    G10L20P3X-5.694Y-7.854Z-19.552
    (G54.1P4 RIGHT BOTTOM)
    G10L20P4X#7041Y-11.522Z-19.552
    GOTO20
    N10
    (PALLET B)
    G10L20P1X-14.149Y-7.854Z-19.552
    (G54.1P2 LEFT BOTTOM)
    G10L20P2X#7001Y-11.522Z-19.552
    (G54.1P3 RIGHT TOP)
    G10L20P3X-5.694Y-7.854Z-19.552
    (G54.1P4 RIGHT BOTTOM)
    G10L20P4X#7041Y-11.522Z-19.552
    N20
    M99

    :1200(2342 P1-4 TRANSLATION)
    #504=#7001(SETS #504 TO X VALUE)
    #506=#7003(SETS #506 TO Z VALUE)
    M98P1300
    #7001=#512(REWRITES X VALUE)
    #7003=#513(REWRITES Z VALUE)
    #504=#7021
    #506=#7023
    M98P1300
    #7021=#512
    #7023=#513
    #504=#7041
    #506=#7043
    M98P1300
    #7041=#512
    #7043=#513
    #504=#7061
    #506=#7063
    M98P1300
    #7061=#512
    #7063=#513
    M99

    :1300(2342 TRANSLATOR)
    #510=ATAN[#101-#504-#502]/[#102-#506-#503] (CALCULATES THE ANGLE)
    #511=[#102-#506-#503]/COS[#510](CALCULATES THE RADIUS)
    #512=#101+[SIN[#5024-#501-#510]*#511](CALCULATES THE NEW X COORD)
    #513=#102-[COS[#5024-#501-#510]*#511](CALCULATES THE NEW Z COORD)
    M99

    This is the general idea I use but the explanation may be a bit bleek. If you want to pursue this idea more, let me know and I will try to give you a better explanation. After all, it is the last Monday of the week!

    Cheers Guys...

    JK

Similar Threads

  1. Macro program
    By pioneerproducts in forum News Announcements
    Replies: 4
    Last Post: 10-08-2007, 09:44 PM
  2. Changing Work offset from the program
    By WITOMCIO in forum Haas Mills
    Replies: 16
    Last Post: 05-14-2007, 01:40 PM
  3. How to set part program offset
    By wayneman in forum Bridgeport / Hardinge Mills
    Replies: 0
    Last Post: 01-25-2007, 07:22 PM
  4. Macro for positive offset
    By qmas99 in forum Uncategorised CAM Discussion
    Replies: 0
    Last Post: 02-12-2006, 04:37 AM
  5. change offset in program
    By jianjianca in forum G-Code Programing
    Replies: 11
    Last Post: 12-22-2005, 05:48 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
  •