Macro programming help


Results 1 to 13 of 13

Thread: Macro programming help

  1. #1
    Ms88's Avatar
    Join Date
    Mar 2020
    Posts
    1
    Downloads
    0
    Uploads
    0

    Default Macro programming help

    Hi. We have a bunch of Doosan puma lathes with fanuc control. Im a fairly experienced cnc programmer. But macros are very unknown for me. I want an easier way for operators to adjust programs. Im looking to make a simple macro program where u can edit x and z offset. We have alot of similar products with different lenght and dimension. I want to have the option to write in the lenght and diameter at the start of the program. But i have no clue how to do this. So i wonder if anyone could give me an example on how to do this?



  2. #2
    Member
    Join Date
    Apr 2011
    Location
    USA
    Posts
    841
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    Look up PROGRAMMABLE PARAMETER ENTRY (G10) in the programming manual for controller that is on your machine.



  3. #3
    Member
    Join Date
    Feb 2011
    Location
    usa
    Posts
    353
    Downloads
    2
    Uploads
    0

    Default Re: Macro programming help

    A couple of books that could help are
    fanuc custom macro b by Sihna
    fanuc cnc custom macro's by Peter Smid



    to have the program make changes to the machining of the part by having the operators change a macro variable
    #1-#33 ARE LOCAL
    #100-#199 ARE COMMON -( POWER OFF RESETS THEM)
    #500-#999 ARE COMMON (STAY ACTIVE DURING POWER OFF)

    O1234
    G00G90G20G40G97G99


    #500=2.000(MATERIAL OD)
    #501=1.900(TURN DIA.)
    #502=-1.000(Z TURN LENGTH)


    N1(TURNING TOOL)
    G28U0.W0.
    G0G97S2000T0101M3
    M8
    G0X[#500+.1]Z.100(MATERIAL DIA.+.100)
    G1Z0.F.005
    G1X-.06
    G0Z.05
    G0X[#501-.05](TURN DIA. -.05)
    G1Z0.F.005
    G1X#500,C.03(TURN DIA WITH CHAMFER.)
    G1Z#502(Z TURN LENGTH)
    G1X#500,C.03(MATERIAL DIA. WITH CHAMFER)
    G1Z[#502-.05](MOVE FOR CHAMFER)
    G0X[#500+.1](CLEARANCE MOVE)
    G0Z-.1
    G28U0.W0.
    M9
    M01

    I would also include some safety's to avoid some crashes if the data is wrong

    IF[#500LT1.75]GOTO9000(SMALLEST OD.)
    IF[#500GT2.500]GOTO9000(LARGEST OD)
    IF[#500LT#501]GOTO9000(TURN DIA LARGER THAN MATERIAL)
    IF[#502GT0.]GOTO9000(Z LENGTH IS POSITIVE)

    N9000( DATA. OUT OF RANGE)



  4. #4
    Member CNCRim's Avatar
    Join Date
    Feb 2006
    Location
    usa
    Posts
    992
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by Ms88 View Post
    Hi. We have a bunch of Doosan puma lathes with fanuc control. Im a fairly experienced cnc programmer. But macros are very unknown for me. I want an easier way for operators to adjust programs. Im looking to make a simple macro program where u can edit x and z offset. We have alot of similar products with different lenght and dimension. I want to have the option to write in the lenght and diameter at the start of the program. But i have no clue how to do this. So i wonder if anyone could give me an example on how to do this?
    Look at RCS60 give you example, it pretty much write one program for a family part and assign movement axis with variables you want.

    The best way to learn is trial error.


  5. #5
    Member
    Join Date
    May 2007
    Location
    USA
    Posts
    1003
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    I'm late to the party so you should already have it figured out. I've got both books mentioned by rcs60. The book by S. K. Sinha is the one you want.

    Let me know if you still need help. I've written several master programs for families of parts. It isn't hard once you write the first program. This is the type of programming I love to do. Consider using macros to control each diameter and to control any possible taper on an O.D. (or I.D.). That way you just put a value in a variable with no need to go into the program and make modifications. Incremental moves for chamfers are your friend.

    .010 x 45 degree chamfer at the face

    G1 X[.9456+#500]Z0F.005
    G3U.0268W-.0056R.019F.002
    G1U.0164W-.0082
    G3U.0112W-.0134R.019 (X1.)
    G1X[1.+#501]Z-1.25F.004
    U.03

    Say you were also turning a 1.375 diameter on the part that also needed a .010 x 45 degree chamfer. Simply cut, paste and modify one value (and in this case a couple variables and obviously the final turned depth).


    G1 X[.9456+#500]Z0F.005
    G3U.0268W-.0056R.019F.002
    G1U.0164W-.0082
    G3U.0112W-.0134R.019 (X1.)
    G1X[1.+#501]Z-1.25F.004
    X[1.3206+#502]
    G3U.0268W-.0056R.019F.002
    G1U.0164W-.0082
    G3U.0112W-.0134R.019 (X1.375)
    G1X[1.375+#503]Z-2.5F.004
    U.03

    B controls are a pain. Our last 2 EMAGS purchased have them. Previous EMAGS and all our other Fanuc controls are C. For a B control:


    G1X[.9456+#500]Z0F.005
    G91G3X.0268Z-.0056R.019F.002
    G1X.0164Z-.0082
    G3X.0112Z-.0134R.019 (X1.)
    G90G1X[1.+#501]Z-1.25F.004
    X[1.3206+#502]
    G91G3X.0268Z-.0056R.019F.002
    G1X.0164Z-.0082
    G3X.0112Z-.0134R.019 (X1.375)
    G90G1X[1.375+#503]Z-2.5



  6. #6
    Member deadlykitten's Avatar
    Join Date
    Jun 2015
    Location
    Antarctica
    Posts
    4131
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    Consider using macros to control each diameter and to control any possible taper on an O.D. (or I.D.).
    q x uz

    1.375 diameter on the part that also needed a .010 x 45 degree chamfe
    q x1.375 (c0.01)

    hy such that becomes input, and postprocesed for whatever you wish / kindly

    we are merely at the start of " Internet of Things / Industrial Revolution 4.0 " era : a mix of AI, plastics, human estrangement, powerful non-state actors ...


  7. #7
    Member
    Join Date
    May 2007
    Location
    USA
    Posts
    1003
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    Quote Originally Posted by deadlykitten View Post
    q x uz



    q x1.375 (c0.01)

    hy such that becomes input, and postprocesed for whatever you wish / kindly
    I think your words got frozen because some letters are missing. Must have broken up and dropped to the ground. I don't understand much of what you said.

    I am aware of putting on chamfers with 'C' (or radius with 'R'), but never have done it for the same reason I never learned to use G41/G42. I was told not to when I first started as my programs had to run on any of our lathes. Most were old enough not to be able to use that kind of programming.

    To the best of my knowledge 'C' will not swing a radius at the beginning and end of a chamfer. The chamfer is made in a straight line. I always swing a radius on chamfers to avoid a burr being kick back which often happens when the insert gets a little worn. If a burr is made when swinging a radius, then you know the insert is shot.

    BTW, I was told in 2008 that the company wanted me to use MasterCam for all my programming. They wanted a newbie to be able to call up the part and change the post processor so it could be run on any of our lathes. Personally I don't do that to run on a different lathe. It is easy for me to make the necessary format changes to go from one lathe to a different one. I have a bunch of Macros in the editor or I do a Ctrl H to make global changes.

    Previously I just used MasterCam to save myself from using a lot of trig. I might have driven a tool or two and copied the output into my program. The rest of the program was manually written.


    MasterCam doesn't do Macro programming worth a damn. LOL.



  8. #8
    Member deadlykitten's Avatar
    Join Date
    Jun 2015
    Location
    Antarctica
    Posts
    4131
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    chamfer is made in a straight line. I always swing a radius on chamfers
    q3 (r0.003c0.01r0.003) x1.375
    q3 x1.355 (r0.003) x1.375u45
    (r0.003)
    q3 x1.355z0 (r0.003) x1.375u45 (r0.003)
    q3 (r0.003) x1.375z0.01u45 (r0.003)


    we are merely at the start of " Internet of Things / Industrial Revolution 4.0 " era : a mix of AI, plastics, human estrangement, powerful non-state actors ...


  9. #9
    Member
    Join Date
    May 2007
    Location
    USA
    Posts
    1003
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    Quote Originally Posted by deadlykitten View Post
    q3 (r0.003c0.01r0.003) x1.375
    q3 x1.355 (r0.003) x1.375u45
    (r0.003)
    q3 x1.355z0 (r0.003) x1.375u45 (r0.003)
    q3 (r0.003) x1.375z0.01u45 (r0.003)
    Thanks. I can see that I need to revisit a programming manual from one of our new lathes.



  10. #10
    Member
    Join Date
    May 2007
    Location
    USA
    Posts
    1003
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    Quote Originally Posted by g-codeguy View Post
    Thanks. I can see that I need to revisit a programming manual from one of our new lathes.
    EDIT: Also deadlykitten I believe you work with Okuma controls. I may not have this flexibility with Fanuc controls. Afraid I haven't checked into this yet. Been swamped and it isn't looking any better in the foreseeable future. If I didn't post from home, I wouldn't be posting. And that's after my wife goes to bed.



  11. #11
    Member deadlykitten's Avatar
    Join Date
    Jun 2015
    Location
    Antarctica
    Posts
    4131
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    If I didn't post from home, I wouldn't be posting. And that's after my wife goes to bed
    you mean posting cnc programs, or posting on cnc zone ? in both cases, seems a bit weird

    why don't you post both from work, and have more free time ?

    we are merely at the start of " Internet of Things / Industrial Revolution 4.0 " era : a mix of AI, plastics, human estrangement, powerful non-state actors ...


  12. #12
    Member
    Join Date
    May 2007
    Location
    USA
    Posts
    1003
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    Quote Originally Posted by deadlykitten View Post
    you mean posting cnc programs, or posting on cnc zone ? in both cases, seems a bit weird

    why don't you post both from work, and have more free time ?
    I mean posting on cnczone. I'm doing a lot of posting (Mastercam) at work. We are always short-handed so I not only trouble shoot, but help set up occasionally. I'm the only programmer for 26 lathes.



  13. #13
    Member deadlykitten's Avatar
    Join Date
    Jun 2015
    Location
    Antarctica
    Posts
    4131
    Downloads
    0
    Uploads
    0

    Default Re: Macro programming help

    you are a bit busy just hang on, a little bit more

    we are merely at the start of " Internet of Things / Industrial Revolution 4.0 " era : a mix of AI, plastics, human estrangement, powerful non-state actors ...


Tags for this Thread

Posting Permissions

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


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

Macro programming help

Macro programming help