Basic programming question

Page 1 of 2 12 LastLast
Results 1 to 20 of 36

Thread: Basic programming question

  1. #1
    *Registered User* Peteuk's Avatar
    Join Date
    Jan 2019
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Basic programming question

    We do a lot of high speed face milling, removing a lot of material in small Z increments. Currently I programmed a sub program with the X and Y movements, but manually input each drop in Z, so it looks like:

    G00 Z1.0
    M98 P4000
    G00 Z0.950
    M98 P4000
    G00 Z0.900

    etc etc...

    Is there a simple line I can add to increment Z from a start position until it reaches zero?

    I'm pretty new to this, so all help gratefully received.

    Pete.

    Similar Threads:


  2. #2
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Quote Originally Posted by Peteuk View Post
    We do a lot of high speed face milling, removing a lot of material in small Z increments. Currently I programmed a sub program with the X and Y movements, but manually input each drop in Z, so it looks like:

    G00 Z1.0
    M98 P4000
    G00 Z0.950
    M98 P4000
    G00 Z0.900

    etc etc...

    Is there a simple line I can add to increment Z from a start position until it reaches zero?

    I'm pretty new to this, so all help gratefully received.

    Pete.
    Why even use a sub this is very simple to give a Z move at the end of each X axes move like, it should never be able to reach Zero tool setting is top of your part work zero every other move is a negative move until you have removed enough material

    %
    O3484
    N1G17G40G80
    T4
    M6
    G54
    S2850M3
    G90G0X0.Y0.
    G43Z.1H4
    G1Z-.01F40.
    X10.
    G1Z-.020
    X0.
    G1Z-.030
    X10.
    G0Z3.
    M9
    M5
    M30
    %

    Mactec54


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

    Default Re: Basic programming question

    This should work for you if you have macro ability



    #100=1.000(STARTING Z)
    #101=.05(CUT INCREMENT)
    #103=.900(FINAL DEPTH)


    while[#100LT#103]DO1
    G0XxxxxYxxxx(start of cut)
    G1Z#100F50.
    M98P4000
    #100=#100-#101
    end1

    G0XxxxxYxxxx(finish pass)
    G1Z#103F50.
    M98P4000



  4. #4
    *Registered User* Peteuk's Avatar
    Join Date
    Jan 2019
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Because Z zero is the finished face, a fixed dim from the bottom of the casting. Doing it in minus increments as you suggest means typing each line long hand, and will be pages long if going to remove an inch of material, which is why I put the X and Y in a sub program and add each Z increment only.



  5. #5
    *Registered User* Peteuk's Avatar
    Join Date
    Jan 2019
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Quote Originally Posted by rcs60 View Post
    This should work for you if you have macro ability



    #100=1.000(STARTING Z)
    #101=.05(CUT INCREMENT)
    #103=.900(FINAL DEPTH)


    while[#100LT#103]DO1
    G0XxxxxYxxxx(start of cut)
    G1Z#100F50.
    M98P4000
    #100=#100-#101
    end1

    G0XxxxxYxxxx(finish pass)
    G1Z#103F50.
    M98P4000
    Hmm, that's probably over my head. I wouldn't know where to place those # values for a start.



  6. #6
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Quote Originally Posted by Peteuk View Post
    Because Z zero is the finished face, a fixed dim from the bottom of the casting. Doing it in minus increments as you suggest means typing each line long hand, and will be pages long if going to remove an inch of material, which is why I put the X and Y in a sub program and add each Z increment only.
    The method you are using is doing the same thing, adding a Z depth after each pass is a slow way to do this, if you write a program it is only one time

    If you don't know about macro programing then most likely your control won't support it anyway

    What you are doing is a crash waiting to happen, all Z movements should be a Negative move when cutting a part

    How big is your machine??

    How big is your Cutter you are using ??

    Depth of cut per pass??

    Material type??

    Mactec54


  7. #7
    Member
    Join Date
    Apr 2016
    Location
    United States
    Posts
    74
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Quote Originally Posted by mactec54 View Post
    The method you are using is doing the same thing, adding a Z depth after each pass is a slow way to do this, if you write a program it is only one time

    If you don't know about macro programing then most likely your control won't support it anyway

    What you are doing is a crash waiting to happen, all Z movements should be a Negative move when cutting a part

    How big is your machine??

    How big is your Cutter you are using ??

    Depth of cut per pass??

    Material type??
    can i ask, what if your tlos are off the bottom of the part? or the table? then your z movements start at z+ and is very common programming.



  8. #8
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Quote Originally Posted by skywalker4 View Post
    can i ask, what if your tlos are off the bottom of the part? or the table? then your z movements start at z+ and is very common programming.
    Yes but only a fool programs that way, measurements are the same no matter where you take them from

    Mactec54


  9. #9
    Member
    Join Date
    Apr 2016
    Location
    United States
    Posts
    74
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    wow, that tells me all i need to know about you. nice.
    so i guess everything you say is right and everyone is a fool?
    well what if parts dont all measure the same and you are trying to hold a tolerance from the bottom of the part? one of 1,000 reasons people program of the table, my god how long have you been doing this?
    i am not even going to bother looking at a response if you send it, because you make yourself sound like a dumbass.



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

    Default Re: Basic programming question

    this is based off of fanuc programming if you have a different control this might be different

    to find if your control has parametric ability
    mdi the following
    #100=1
    if no alarm then you have parametric programming

    The # numbers can be located at the beginning of the program or just prior to the while statement
    #100=1.000(STARTING Z)
    #101=.05(CUT INCREMENT)
    #103=.900(FINAL DEPTH if this were 0 then 20 passes would be made doing the while statement)


    while[#100LT#103]DO1(while #100 is less than #103 do this again when it is equal or more than stop the cycle go to end1)
    G0XxxxxYxxxx(start of cut this can be in you o4000 program but i like it here to make sure that it is in the right place before the z comes down)
    G1Z#100F50.(each pass will be .05 less than the previous on)
    M98P4000
    #100=#100-#101(this makes #100 smaller by the amount in #103)
    end1

    this is to be sure that your finish pass is always the correct depth

    G0XxxxxYxxxx(finish pass)
    G1Z#103F50.(in this case the last pass would be .05 same as the rest of them)
    M98P4000

    I am with skywalker4 sometimes using plus dimension is very applicable for machining something
    castings might be one of those time were the datum is the mounting surface and the variable is the casting where you can start high to make sure the casting variation are accounted for

    two good books to read for parametric programming are from "shinha and peter smid"



  11. #11
    Member mactec54's Avatar
    Join Date
    Jan 2005
    Location
    USA
    Posts
    15362
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Quote Originally Posted by skywalker4 View Post
    wow, that tells me all i need to know about you. nice.
    so i guess everything you say is right and everyone is a fool?
    well what if parts dont all measure the same and you are trying to hold a tolerance from the bottom of the part? one of 1,000 reasons people program of the table, my god how long have you been doing this?
    i am not even going to bother looking at a response if you send it, because you make yourself sound like a dumbass.
    It's obvious that you are self taught, there are sometimes that you do and can program your part from the table, especially when the part is fastened to the table, and you have accurate probing, the part still has to be measured the same way, there is no way around part measurement , unless you have an uneducated guess at how to do that as well

    Where you fell over yourself is you don't understand what the OP was doing, he is adding a Z move manually after each facing pass, and this sure is a Crash waiting to happen, when doing it like this

    Last edited by mactec54; 01-25-2019 at 03:16 PM.
    Mactec54


  12. #12
    *Registered User* Peteuk's Avatar
    Join Date
    Jan 2019
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Quote Originally Posted by skywalker4 View Post
    wow, that tells me all i need to know about you. nice.
    so i guess everything you say is right and everyone is a fool?
    well what if parts dont all measure the same and you are trying to hold a tolerance from the bottom of the part? one of 1,000 reasons people program of the table, my god how long have you been doing this?
    i am not even going to bother looking at a response if you send it, because you make yourself sound like a dumbass.
    Thank you .. Of course it's programmed off the table. It's a fixed z zero dim from the table to the top machined face. There's neither been a "crash waiting to happen".. I'm certainly no fool, there was no need for that.Thanks again



  13. #13
    *Registered User* Peteuk's Avatar
    Join Date
    Jan 2019
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Quote Originally Posted by rcs60 View Post
    this is based off of fanuc programming if you have a different control this might be different

    to find if your control has parametric ability
    mdi the following
    #100=1
    if no alarm then you have parametric programming

    The # numbers can be located at the beginning of the program or just prior to the while statement
    #100=1.000(STARTING Z)
    #101=.05(CUT INCREMENT)
    #103=.900(FINAL DEPTH if this were 0 then 20 passes would be made doing the while statement)


    while[#100LT#103]DO1(while #100 is less than #103 do this again when it is equal or more than stop the cycle go to end1)
    G0XxxxxYxxxx(start of cut this can be in you o4000 program but i like it here to make sure that it is in the right place before the z comes down)
    G1Z#100F50.(each pass will be .05 less than the previous on)
    M98P4000
    #100=#100-#101(this makes #100 smaller by the amount in #103)
    end1

    this is to be sure that your finish pass is always the correct depth

    G0XxxxxYxxxx(finish pass)
    G1Z#103F50.(in this case the last pass would be .05 same as the rest of them)
    M98P4000

    I am with skywalker4 sometimes using plus dimension is very applicable for machining something
    castings might be one of those time were the datum is the mounting surface and the variable is the casting where you can start high to make sure the casting variation are accounted for

    two good books to read for parametric programming are from "shinha and peter smid"
    Thanks so much. That makes far more sense now. shall be experimenting first thing Monday, ,, just one dumb question:

    This line:

    while[#100LT#103]DO1

    Is the actual word "while" typed in? Does it matter if upper or lower case? Hope that didn't make you laugh to much ... Thanks for the pointers on the books, off to search for those.



  14. #14
    Flies Fast Superman's Avatar
    Join Date
    Dec 2008
    Location
    Antarctica
    Posts
    3109
    Downloads
    0
    Uploads
    0

    Default

    Quote Originally Posted by mactec54 View Post
    Yes but only a fool programs that way, measurements are the same no matter where you take them from
    so I'm a fool also ??? ....
    and I would be using a CAM system to output the code
    .... many would progam their 2nd op this way. It is so much simpler, not having to move an origin away from a fixed or fixture location point.

    your comments are so bullish because they won't do it "your way".... get off your high horse, ppl come here for help & to pass on experiences.... not to be insulted.

    wish I could deduct rep points



  15. #15
    Member dharmic's Avatar
    Join Date
    May 2015
    Location
    Australia
    Posts
    1422
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Go easy guys: mactec has built up a fair old body of knowledge over the years and, even if his interpersonal skills make him the guy you leave at the back of the workshop (or preferably in another suburb) when clients, suppliers, family, friends etc are visiting, his advice can be quite useful. So long as his way of doing things suits what you need in a particular case. Calling him out on his sh1tty behaviour just gets him all frothy at the mouth and shouty which doesn't help anyone.

    FWIW I've always been taught to zero my workspace at the back top right corner so that all cutting moves are in negative space, get into positive and you're "safe". And I still normally work that way. Unless I'm on a 4th axis, or doing the flip side of a piece on a 2nd operation, or...

    Thanks Pete for sharing - kinda interested now to see if I can do some of that stuff on my gear rather than having to write VB macros or post scripts to handle the loops!



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

    Default Re: Basic programming question

    The code is written in all caps like normally sorry about the confusion

    WHILE[#100LT#103]DO1



  17. #17
    *Registered User* Peteuk's Avatar
    Join Date
    Jan 2019
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Quote Originally Posted by rcs60 View Post
    The code is written in all caps like normally sorry about the confusion

    WHILE[#100LT#103]DO1
    Brilliant, thanks again



  18. #18
    *Registered User* Peteuk's Avatar
    Join Date
    Jan 2019
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    I didn't mean to open a can of worms over what is right or wrong here. The basic principle of having plus Z until Zero is not new. I've worked in a couple of places that have worked like this.

    The reason for doing so is that once the facemill has finished at Z Zero, that is where all other features and dimensions are taken from. IE: If the drawing shows a hole at 3" deep then it's programmed minus 3".. from the finished machined face. It's just a lot easier to program to actual drawing dimensions this way.

    The highest point of the casting is always probed, with a plus figure added in the cycle, raising the Z again, so quite often the 1st pass of the facemill is in fresh air.
    In all the years I've been doing this, I've never seen a crash.

    Cheers,
    Pete



  19. #19
    Member dharmic's Avatar
    Join Date
    May 2015
    Location
    Australia
    Posts
    1422
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Can of worms? Welcome to the wonderful world of forums, where you just never know what comment will light some champion's fuse. I personally love hearing how different people do things and the thinking behind the decisions, so long as it doesn't get nasty. And - fortunately - there are only a couple of members here who lack the social skills of polite argument or conversation. Generally it's just good info and ideas getting thrown around.

    Got you now. Unless you're including the dimensions of the workpiece in the toolpath dimensions, measuring and changing for any variations each time around, then your approach of taking datum from the top of the faced operation rather than the rough casting makes a lot of sense - particularly if you have a few to do and there's a heap of variability. And, now I think about it, that's exactly how I roll too. Clamp up, zero off where the finished workpiece needs to be, include a few air cuts in the toolpath because they're much better than a rapid feed smack into 2mm of casting (learnt that one the hard way, a long time ago).

    I've worked in a shop where datum was the centre of the table and that worked well too, but they had modelled every tombstone, fixture and workpiece to within a thou and they had a separate machine cutting the billet to size. Which to me always seemed like an insane amount of extra work but it meant they could keep a big horizontal machine with pallet changer hammering non stop with the "important" stuff and use a little VF2 or something to skim down the stock for clamping. Not my cup of tea, perhaps that mindset is part of the difference between my world of job/tool shop work versus full production line machining.



  20. #20
    *Registered User* Peteuk's Avatar
    Join Date
    Jan 2019
    Posts
    13
    Downloads
    0
    Uploads
    0

    Default Re: Basic programming question

    Believe it or not, I've been around CNC's since they were NC's with that damn ticker tape (that always had a habit of breaking and sent the machine off somewhere fatal). I did my apprenticeship with British Aerospace, and from there got onto the mills, then CNC's.
    90% of the programs were done off machine by employed programmers. All we needed to know was basic editing, but even then we had to get one of the programmers down to enable and witness any edits. I guess that's the strict regulations involved when it's for the military. (At that time is was parts for the Harrier jump jet).

    It's been the same with the other companies I've worked for. All aerospace components. It's only recently that I moved to a small petrochemical company that manufactures their own product. (Solenoid Valves - Relief Valves - Check Valves | BiS Valves) The interesting part is that there is no Cad-Cam. Everything is done by manual input, by us 3. (Yep, three of us, to 4 mills, rest are lathes. Told you it was small). Whilst a lot of it is easy, as the basis of the product is very similar, therefore it's a quick Copy / Paste and edit, I've seen areas where so much time is wasted by all that manual inputting. That has lead to scrap at times by one line being wrong etc.

    That's why I asked the question here to begin with. Using that macro eliminates masses of lines for a start. As it's mainly all stainless / super duplex, with as much as an inch to remove sometimes, using a high speed face mill, taking small but fast cuts of normally 0.030" you can imagine just how many lines there are to go down one inch. A LOT :-)



Page 1 of 2 12 LastLast

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

Basic programming question

Basic programming question