Results 1 to 12 of 12

Thread: Basic G-Code Question

  1. #1
    Registered
    Join Date
    Jul 2003
    Location
    Colorado
    Posts
    71
    Downloads
    0
    Uploads
    0

    Basic G-Code Question

    OK I just started a new job after I have been programming for the past few years and there is a lot a debate going on right now on the proper use of starting a program, the end of a tool op and calling up a new tool. I have two example I believe they are doing the same exact thing however the other programmers say no. We are running these programs on HAAS VMC's. Hince the major changes are G90 and G91

    So this is how I start a program minus the % and O0000
    Code:
    G0 G17 G40 G49 G80 G90
    T2 M6
    G0 G54 X1. Y1. S3600 M3
    G43 H2 Z.1
    /M8
    Then at the end of a op

    Code:
    G0 Z1.
    M9
    G28 Z0 
    M1
    Then start of next op
    Code:
    T3 M6
    G0 G54 X2.7277 Y6.0404 S500 M3 
    G43 H3 Z0.1
    /M8



    Now this is how they think it should be done, however I believe it is the same thing just adding more code!!!

    Code:
    G0 G17 G40 G49 G80 G90
    T2 M6
    G0 G90 G54 X1. Y1. S3600 M3
    G43 H2 Z.1
    /M8
    Then at the end of a op

    Code:
    G0 Z1.
    M9
    G28 G91 Z0 
    M1
    Then start of next op
    Code:
    T3 M6 
    G0 G54 G90 X2.7277 Y6.0404 S500 M3 
    G43 H3 Z0.1
    /M8


  2. #2
    Registered Vin007's Avatar
    Join Date
    Jun 2007
    Location
    U.S.A.
    Posts
    8
    Downloads
    0
    Uploads
    0

    Cool Programers choice.

    Hi, Tazzer,
    I work in a shop with 7 different CNC mills and the one rule that holds true in programing is that the lead guy sets the standard. What you have are both valid on the HAAS, but to limit confusion in our shop we follow the style of our lead. This cuts down on confusion for us and lets us known what to look for in a program.

    Vin007
    Machine it like you stole it!


  3. #3
    Registered
    Join Date
    Jul 2003
    Location
    Colorado
    Posts
    71
    Downloads
    0
    Uploads
    0
    Thanks Vin007

    Thanks for your input. Thats are problem right now, there is no true lead and everyone is doing things there way with no real direction.

    Anyway I just wanted to know if I was wrong or not.

    Clint


  4. #4
    Registered
    Join Date
    Jan 2007
    Location
    USA
    Posts
    355
    Downloads
    0
    Uploads
    0
    We use primarily Fanuc controls. The G91 G28 Z0 command is the norm.

    Read post #1 of this link for an explanation:

    Using Fanuc's G28
    Diplomacy is the art of saying "Nice doggie" until you can find a rock. - Will Rogers


  • #5
    Registered beege's Avatar
    Join Date
    Feb 2008
    Location
    USA
    Posts
    547
    Downloads
    0
    Uploads
    0
    Redundant code is safer than non-existent code. G90 on every line is not harmful, nor is G17 (unless you need something else). I don't program on HAAS, but won't "G28 Z0" rapid to fixture Z0 before going to the reference point, since you are still in G90? G28 G91 Z0 shouldn't move anywhere before going to the reference point. If you have machines with different controls, it makes sense to keep the rules as consistent as possible.


  • #6
    gar
    gar is offline
    Registered
    Join Date
    Mar 2005
    Location
    USA
    Posts
    1498
    Downloads
    0
    Uploads
    0
    080327-2036 EST USA

    Tazzer:

    The extra G90 is not needed at the start. What about a D to go along with H?

    If I am not changing the tool I would go to an adequate Z clearance relative to G54, and then proceed.

    The tool change function knows where the tool change Z location is and it does not do any X Y move. No need for G28 G91 Z0.

    At program end I do something like

    M09
    M05
    G53 G0 Z0 (non-modal) (to tool change position to be vertically out of the way)
    G53 X-30. Y0 (move table to a desired unload position - do not care what G5x was used)
    M30

    I have a whole different method for tool change that uses an external subroutine and tool diameters are controlled within the program. The subroutine is:

    O6901
    G10 G90 L12 P#7 R#18
    G80 M09
    G90 M06 T#20
    G#8 M08
    S#19 M03
    G43 H#20 D#7
    M99

    The tool change calling line is like this:
    G65 P6901 E54 R0.625 S5000 T02 D02
    The 0.625 could be replaced by #500 for example and at the start of the program
    #500 = 0.625 or whatever for this tool.

    I can easily read the tool change calling line in comparison with all the garbage in the subroutine.

    How you would modify this approach would depend upon on how you want to structure a program.


    .


  • #7
    Registered
    Join Date
    Jan 2008
    Location
    USA
    Posts
    30
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by beege View Post
    Redundant code is safer than non-existent code. G90 on every line is not harmful, nor is G17 (unless you need something else). I don't program on HAAS, but won't "G28 Z0" rapid to fixture Z0 before going to the reference point, since you are still in G90? G28 G91 Z0 shouldn't move anywhere before going to the reference point. If you have machines with different controls, it makes sense to keep the rules as consistent as possible.
    Agreed. Any of us who have been around word address programing (g-code) for any length of time should agree with this statement. There was a time before the tool change macros evolved enough to take the z axis to the tool change position, when if the macro was initiated without the tool being home, the tool changer would crash into the head of the machine. Hell, I was around when the code had to be entered in a specific order. Let's not even start about the old paper tapes. In short, I think it is better to have the extra code in the program and not need it, then to need the extra code and not have it.
    It is the poor craftsman that blames the tool


  • #8
    Registered
    Join Date
    Nov 2007
    Location
    Canada and Nothern ireland
    Posts
    117
    Downloads
    0
    Uploads
    0
    On a Fanuc controlled machine it is a good practise to put the m6 in a macro progam like this and create a home postion on to

    M6--Calls--set up in the parameters--6071 i believe
    O9001
    G00G90G40G80G49
    G00G91G30Z0.0M19
    G00G91G30X0.0Y0.0M9
    G90
    M6
    M99


    O0001 (MAIN IS LIKE THIS)
    M200---(Home Position macro)
    N1----M98 p101(sub first tool)
    N2----M98 P102(sub second tool)
    and so on --now you can move your tool operation around easy

    O101(First sub)
    T1M6
    G00G54P1X0.0Y0.0G43Z0.0H1Z100.0M03 S1000
    G00Z1.0T2M8
    ()
    ()
    G200
    M99


  • #9
    Registered CNCRim's Avatar
    Join Date
    Feb 2006
    Location
    usa
    Posts
    949
    Downloads
    0
    Uploads
    0
    Tazzer,

    Everyone has some idea how this and that should be done... but the ultimate right way is the machine except the code and doesn't make any fun move/rapide crack move, part all come out good..... who care what is the code look like or should be like.
    The best way to learn is trial error.


  • #10
    Registered
    Join Date
    Aug 2007
    Location
    US
    Posts
    14
    Downloads
    0
    Uploads
    0
    Tazzer,

    Here's the way I program parts (Fanuc controllers). Just remember that there are numerous ways to program the same part. You will be more successful if you do everything the same every time. If you do everything the same every time, it will be easier to spot mistakes and easier for the operators to know what they're looking at. It sounds like you are in the postition to set the direction so be consistent and people will follow suit. This was the same position I was in when I started at my current company two years ago. I just made sure that I was consistent with every program and eventually everybody jumped on board with my way of doing things.

    I've been told that no programmer will like the way another programmer programs machines.

    N3 T14
    M06
    (*T14=<D0266C>=17/64 DRILL .266 CARB 8)
    (MIN LENGTH=STD.)
    G0 G40 G80 G90 M08
    G54.1 P9 X.31 Y-.5 S1500 M03
    G43 Z.5 H14 T15

    G80 M09
    G91 G28 Z.0
    M01
    Last edited by Jason812; 04-04-2008 at 10:58 AM. Reason: grammer


  • #11
    Registered thamain1's Avatar
    Join Date
    Aug 2006
    Location
    USA
    Posts
    8
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by newtexas2006 View Post
    Tazzer,

    Everyone has some idea how this and that should be done... but the ultimate right way is the machine except the code and doesn't make any fun move/rapide crack move, part all come out good..... who care what is the code look like or should be like.
    One thing as far as form goes is that too much programming and redundancy leads to "bottlenecking" in the controller. The more you push in the longer the controller takes to "read" it. In a high demand job shop, espc. high speed shops, every milli second counts. We use the least amount of programming inputs as possible, use the lead man's basic form and find ways to "prefetch", tools etc., when it permits. If it's Modal and you can leave it on then don't repeat it. At our shop the saying is "Better (quality) and Faster (time is money)"


  • #12
    Registered
    Join Date
    May 2007
    Location
    USA
    Posts
    939
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Jason812 View Post
    I've been told that no programmer will like the way another programmer programs machines.
    Ain't that the truth! LOL. Some of us try to keep an open mind...realizing that our way isn't the only way. I have occasionally made a a minor change to how I program because I thought someone else's way was better. I program my way because I also set up and ran lathes for many years. While learning I often rewrote a program several times if I was having problems with chatter, tool life, finish, etc. After a while I finally learned what usually works.

    I don't believe in hard and fast rules. There will always be the exception.

    As far as redundancy goes, I try to avoid it. I like my programs to be as clean as possible. Unfortunately the occasional one is unavoidable given the quality of our operators. Have to do my best to protect the operators from themselves ya know.

    I like operations that get used on almost every job, such as barstop and cut-off, to be in subprograms. I've put these, and a few other subs, in the G or M-call 9000 series programs. Can't be accidentally deleted. Maybe one other guy in the shop, beside the programmers, know how to edit one. Plus it means less typing for me.

    If I programmmed mills, I believe I would be doing something along the line of how "lshingleton" programs.

    We are a small shop. Mills and lathes are done by different people. Lathe guy never works on a mill. And vice versa, tho I have given speed and feed recommendations on occasion to the mill foreman (who also does some programming).

    If you have several programmers, and they all work interchangeably on the lathes and/or mills, then I can see why it is necessary to set a format for all to follow. Even tho it may not affect any of you as programmers, I can pretty much guarantee that the people on the floor will be confused if you don't.

    Going back to Jason's quote. We have 2 lathe programmers. One programs using Mastercam only. Other doesn't. First one doesn't like to touch the second one's programs because he uses macros, variables, and subs in almost every program. This has led to the plant manager ruling that Mastercam will be used for all new programs, and that any repeat job not done in Mastercam be re-done in Mastercam also.

    Why? Consistency.


  • Similar Threads

    1. Basic pocketing question
      By MachineManiac in forum Mastercam
      Replies: 32
      Last Post: 12-22-2007, 04:23 PM
    2. Very Basic Question
      By H2ODiver in forum General CAM Discussion
      Replies: 4
      Last Post: 07-27-2007, 09:51 AM
    3. visual basic question
      By keebler303 in forum Visual Basic
      Replies: 5
      Last Post: 09-05-2006, 03:11 PM
    4. Basic Machining Question
      By asperjack in forum General Metalwork Discussion
      Replies: 1
      Last Post: 05-25-2006, 11:19 AM
    5. REALLY basic Question
      By Dongle in forum Mechanical Calculations/Engineering Design
      Replies: 25
      Last Post: 03-14-2006, 04:47 PM

    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.