584,833 active members*
5,432 visitors online*
Register for free
Login
IndustryArena Forum > CAM Software > Mastercam > issue with post or a mx5 setting?
Page 1 of 2 12
Results 1 to 20 of 22
  1. #1
    Join Date
    Jan 2010
    Posts
    321

    issue with post or a mx5 setting?

    i have been using a mach 3 post that has been modded to suit a 3 axis mill with manual tool change, the notes in the post say it will return the z to the top of the travel to make changing tools a breeze.

    the post was downloaded from a site that gets mentioned quite a bit on a google search and i assume many other mach3 users are using the same post and would also assume that any bugs would have well and truly been ironed out of it due to the large amount of users. this makes me think the issue may be a mach 3 or mastercam setting issue not a post problem as why would the author of the post say it does a certain move and then when put into practice is doen the opposite.

    the issue i have is at tool chane and end of program it outputs a move that wants to send the cutter through the job or table or vice.

    it outputs something like

    g0 z25
    g49 z0
    x0 y0
    a0

    then goes into tool change or end of program.
    all i have been doing to fix this is delete the z0. i am tipping this z0 is ment to be in mach co-ord so that it returns the spindle to the top to change tools.

    what do you guys think?

  2. #2
    Join Date
    May 2004
    Posts
    4519
    Problem seems to be in the post processor. Why they would advertise something that is not true could be because they did not test it in all conditions or they lied. G49 is tool length compensation cancel. This puts the zero point back to the spindle face. Then the spindle tries to go to the Z0. level. You can edit your post and remove the Z0. for every line that has G49. Now, this will not give you full retract for tool change. To retract Z to a tool change position, you will probably either need to use G28 G91 Z0. or G53 Z0. If you need to add this after the G49 lines, use the syntax of the rest of the lines in the post processor as example.

  3. #3
    Join Date
    Jan 2010
    Posts
    321
    i have attached a copy of the post i am using.

    i had a play around tonight with a line of code as per your suggestion.

    i found another post that output similiar to your below line of g91 g28 z0 so i replaced parts of my code to replicate it and it worked great.

    so it went from what i typed in my first post to this (example from tested code)

    N6690 X80. Y7.75 I0. J1.5
    N6700 G0 Z10.
    N6710 M5
    N6720 G91 G28 Z0. M9
    N6730 X0. Y0.
    N6740 A0.
    N6750 M01
    N6760 G49 T6 M6
    N6770 G0 G90 G54 X-3. Y14.29 A0. S4000 M3
    N6780 G43 H6 Z10. M8

    this code worked good but has 2 issues. first on line N6770 it outputs a xy move for what looks like no reason. i would understand if it output a move before the tool change to get the job out of the way of the tools to avoid any accidental damage when changing.

    next it doesn't move to the x0 y0 on line n6730. i assume this is because i need g0 in front of the x0 y0?

    my next question is how do i edit the post to give me what i need?
    Attached Files Attached Files

  4. #4
    Join Date
    May 2004
    Posts
    4519
    G28 is a non-modal command. You will need to repeat it on block 6730. Otherwise it is just doing an incremental (G91) X0. Y0. move.

  5. #5
    Join Date
    Jan 2010
    Posts
    321
    figured it would be something like that.

    any ideas on editing?

  6. #6
    Join Date
    May 2004
    Posts
    4519
    The post you uploaded is doubtful to have been edited to output the code you uploaded. Here is the first instance of problem(s):

    #pfbld, n$, sgabsinc, *sg28ref, "Z1.", e$
    #pfbld, n$, *sg28ref, "X0.", "Y0.", e$
    #pfbld, n$, sg92, *xh$, *yh$, *zh$, e$
    pfbld, n$, "G49", "G0", "Z0.", e$
    pfbld, n$, "X0.", "Y0.", e$

    Probably needs edited to:

    #pfbld, n$, sgabsinc, *sg28ref, "Z1.", e$
    #pfbld, n$, *sg28ref, "X0.", "Y0.", e$
    #pfbld, n$, sg92, *xh$, *yh$, *zh$, e$
    #pfbld, n$, "G49", "G0", "Z0.", e$
    #pfbld, n$, "X0.", "Y0.", e$
    pfbld, n$, sgabsinc, *sg28ref, "Z0.", e$
    pfbld, n$, *sg28ref, "X0.", "Y0.", e$


    The next area of concern is:

    #pfbld, n$, *sg28ref, "X0.", "Y0.", e$
    #pfbld, n$, sg92, *xh$, *yh$, *zh$, e$
    pfbld, n$, "G49", "G0", "Z0.", e$
    pfbld, n$, "X0.", "Y0.", e$

    Should probably read:

    #pfbld, n$, *sg28ref, "X0.", "Y0.", e$
    #pfbld, n$, sg92, *xh$, *yh$, *zh$, e$
    #pfbld, n$, "G49", "G0", "Z0.", e$
    #pfbld, n$, "X0.", "Y0.", e$
    pfbld, n$, sgabsinc, *sg28ref, "Z0.", e$
    pfbld, n$, *sg28ref, "X0.", "Y0.", e$


    Do you see the pattern yet?

    The next area is:

    # pbld, n$, sgabsinc, sgcode, *sg28ref, "Z1.", scoolant, e$
    # if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, "X0.", "Y0.", protretinc, e$
    # pbld, n$, sgabsinc, "Z1.", scoolant, e$
    pbld, n$, "G49", "G0", "Z0.", scoolant, e$
    pbld, n$, "X0.", "Y0.", scoolant, e$

    Should probably read:

    # pbld, n$, sgabsinc, sgcode, *sg28ref, "Z1.", scoolant, e$
    # if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, "X0.", "Y0.", protretinc, e$
    # pbld, n$, sgabsinc, "Z1.", scoolant, e$
    #pbld, n$, "G49", "G0", "Z0.", scoolant, e$
    #pbld, n$, "X0.", "Y0.", scoolant, e$
    pbld, n$, sgabsinc, *sg28ref, "Z0.", e$
    pbld, n$, *sg28ref, "X0.", "Y0.", e$

    Notice, I did not delete anything. I commented out the lines to be edited and then added new lines under those.

  7. #7
    Join Date
    Jan 2010
    Posts
    321
    The post i attached doesn't output the N6720 G91 G28 Z0. M9
    this was what another mach3 post output but that post has issues in another area as it wont do arcs for some reason. mach3 posts an error.

    the post that i have been using and want to keep using so far works everywhere else but on the end of program and on tool changes due the to issues you have pointed out.

    anyway i had noticed the g49 g0 z0 areas that you make mention of but i don't know how to edit and resave as a .pst file.

    yes i see the pattern you mention. basically i assume that mastercam will ignore a line with # at the start?

    so anything with the G49 G0 Z0 and x0 y0 needs to be commented out and more or less changed to the g28 z0 and g28 x0 y0

    did i need the g91 in there aswell?

    is there something within mastercam that lets me make these changes???

  8. #8
    Join Date
    May 2004
    Posts
    4519
    Then the edits I showed probably won't work since it was not the correct post processor to begin with. "sgabsinc" should input G91 when appropriate. If it does not, you can use "G91" instead. Any ASCII text editor can open and edit and save a .PST file.

  9. #9
    Join Date
    Jan 2010
    Posts
    321
    thanks for your help btw

    it is the correct post. the one i attached and the one you looked at is the one i want to use and edit.

    had a play around with the post using notepad. have now got it outputting the following.

    N520 G0 Z24.75
    N530 M5
    N540 G91 G28 Z0.
    N550 G28 X0. Y0.
    N560 A0.
    N570 M01
    N580 G49 T31 M6
    N590 G0 G90 G54 X7.724 Y28.455 A0. S4000 M3
    N600 G43 H31 Z25.
    N610 G99 G81 Z-12. R25. F400.
    N620 G80
    N630 M5
    N640 G91 G28 Z0.
    N650 G28 X0. Y0.
    N660 A0.
    N670 M01
    N680 G49 T19 M6
    N690 G0 G90 G54 X8.943 Y11.789 A0. S4000 M3
    N700 G43 H19 Z25.
    N710 G99 G81 Z-12. R25. F240.
    N720 G80
    N730 X21.951 Y20.325
    N740 G99 G83 Z-12. R25. Q2. F240.
    N750 G80
    N760 M5
    N770 G91 G28 Z0.
    N780 G28 X0. Y0.
    N790 A0.
    N800 M30

    this works great except for the odd movements after tool change on line n590 and n690. this give me a limit switch issue as the table wants to move further and then trips the limit switch. any ideas why it outputs this move? it seems a different move each tool change.

    if this is a bit odd then it may just be easier to change the g28 x0 y0 line to something that gets the spindle away from the work so i am not changing tools above the job

  10. #10
    Join Date
    Jan 2010
    Posts
    321
    another thing i noticed is that when the machine is doing an arc it nearly looks like the pulley stops rotating half way thourgh the arc.

    i also see in the contol definition that there is a 'break arcs' check box.
    atm it is set to break arcs at quadrant.

    should i change this.???

  11. #11
    Join Date
    May 2004
    Posts
    4519
    I do not see anything obviously wrong about blocks 590 and 690. That should be the output of your hole position on the part referenced from the G54 work zero point that you set on the machine. If you set G54 incorrectly, you will have problems. I am guessing that your G54 settings on your work offset table should be reading negative numbers. Are you setting a machine home position in the operation?

    During an arc, as one axis reaches a quadrant, it will have to come to a stop, and then reverse itself if the arc continues past the quadrant. No idea what the requirements for your machine control for arcs is. Most machines can run 180 degrees of arc without any problems.

  12. #12
    Join Date
    Jan 2010
    Posts
    321
    i will have to check tonight about the g54 figures but i do believe they are negitive.

    before doing anything i have home the machine.

    i assumed the issue was the movement on the lines i mentioned as if i didnt have limit switches the machine would crash after pressing cycle start after tool change.

    will investigate further tonight. as i was running other code output by the same post after the tool change the first move it made was about 150mm further away from the job then rapid back to the job and start cutting. this was the confusing part as i didn't understand why it would move away from the job after the tool change, before the TC i would understand but not after.

    i will try 180deg arcs and see what happens.

  13. #13
    Join Date
    Dec 2012
    Posts
    26

    some thoughts

    Your code looks right as far as the two lines you say are giving you trouble. Double check that your G54 is set correctly. Also if you are just wanting to move your table away before tool changes, use an offset that you don't typically use. Our shop has mainly Haas machines so there are a ton of extra offsets to use. You can so something like G0 G90 G58 x0 Y0. Then you just set G58 X0 Y0 where ever you want the table to go before the tool change. We find this is the easiest way because then zero is hard coded in the post but you can move it anywhere depending on what you are working on by just changing where G58 is set.

  14. #14
    Join Date
    Dec 2008
    Posts
    3110
    N520 G0 Z24.75
    N530 M5
    N540 G91 G28 Z0.
    N550 G28 X0. Y0. <--- suggest only to have the Y move, unless tool will hit part on toolchange
    N560 A0. <---- your problem is here, you are still in incremental, needs a G90
    N570 M01
    ....
    N660 A0.
    N670 M01
    N680 G49 T19 M6

    this works great except for the odd movements after tool change on line n590 and n690. this give me a limit switch issue as the table wants to move further and then trips the limit switch. any ideas why it outputs this move? it seems a different move each tool change.

    the G54 line is...set G54 co-ord system and then goto those X/Y/A points in relation to the G54 origin.... the part's XYZ origin is input into the Work Offset area in the control - it relates back to the home position of the machine.

    if this is a bit odd then it may just be easier to change the g28 x0 y0 line to something that gets the spindle away from the work so i am not changing tools above the job

  15. #15
    Join Date
    Jan 2010
    Posts
    321
    thanks guys.

    had a play around with it. the offset idea sounds great but had a quick play around and obviously set it wrong as it kept wanting to trip the z limit switch.
    like i said i am sure it was my settings doing this.

    i had been playing around with g90 in the g28 x0 y0 line but it wasn't playing ball. then read your reply and was glad to read i was at least on the right track. i then edited the gcode manually to read.

    g28 x0 y0
    a0 g90

    this got rid of my movement straight after the tool change ( as it turns out the lines i thought were causing problems werent the issue as you guys suggested)

    i then looked at the post and couldn't find were it adds the A0 after the
    g28 x0 y0
    so i just added a line in the post after it with just G90 on it.so it reads
    M5
    N650 G91 G28 Z0.
    N660 G28 X0. Y0.
    N670 G90
    N680 A0.
    when i post code now i can plug it straight into the machine without editing (so far with basic testing anyway)

    here is a sample of a simple 40mm square with a contour and 4 holes all using different drills/tools. This code is unedited after posting and i ran it through the mill as is and worked a treat. at least i know were in the post this toolchange section is so if i want to play around at a later date i have a little bit of a clue what goes on as i think i will get tired of the table retuning the the home position every tool change. but either way it beats the hell out of manually editing a code as if i get it wrong it is a big crash.

    anything wrong with what i have edited the post to output???


    ( T1 | 14. FLAT END MILL | H1 )
    ( T124 | 7 DRILL | H124 )
    ( T19 | 5MM DRILL | H19 )
    ( T4 | 6.8 DRILL | H4 )
    ( T21 | 10MM TX-DRILL | H21 )
    N100 G21
    N110 G0 G17 G40 G49 G80 G90
    N120 G49 T1 M6
    N130 G0 G90 G54 X-35. Y6. A0. S2046 M3
    N140 G43 H1 Z25.
    N150 Z10.
    N160 G1 Z-12. F306.9
    N170 X-21. F613.8
    N180 G3 X-7. Y20. I0. J14.
    N190 G1 Y40.
    N200 G2 X0. Y47. I7. J0.
    N210 G1 X40.
    N220 G2 X47. Y40. I0. J-7.
    N230 G1 Y0.
    N240 G2 X40. Y-7. I-7. J0.
    N250 G1 X0.
    N260 G2 X-7. Y0. I0. J7.
    N270 G1 Y20.
    N280 G3 X-21. Y34. I-14. J0.
    N290 G1 X-35.
    N300 G0 Z25.
    N310 M5
    N320 G91 G28 Z0.
    N330 G28 X0. Y0.
    N340 G90
    N350 A0.
    N360 M01
    N370 G49 T124 M6
    N380 G0 G90 G54 X10. Y10. A0. S300 M3
    N390 G43 H124 Z25.
    N400 G99 G81 Z-3. R25. F7500.
    N410 G80
    N420 M5
    N430 G91 G28 Z0.
    N440 G28 X0. Y0.
    N450 G90
    N460 A0.
    N470 M01
    N480 G49 T19 M6
    N490 G0 G90 G54 X10. Y30. A0. S4000 M3
    N500 G43 H19 Z25.
    N510 G99 G81 Z-6. R25. F240.
    N520 G80
    N530 M5
    N540 G91 G28 Z0.
    N550 G28 X0. Y0.
    N560 G90
    N570 A0.
    N580 M01
    N590 G49 T4 M6
    N600 G0 G90 G54 X30. Y30. A0. S2200 M3
    N610 G43 H4 Z25.
    N620 G99 G81 Z-5. R25. F330.
    N630 G80
    N640 M5
    N650 G91 G28 Z0.
    N660 G28 X0. Y0.
    N670 G90
    N680 A0.
    N690 M01
    N700 G49 T21 M6
    N710 G0 G90 G54 X30. Y10. A0. S4000 M3
    N720 G43 H21 Z25.
    N730 G99 G81 Z-2. R25. F1389.9
    N740 G80
    N750 M5
    N760 G91 G28 Z0.
    N770 G28 X0. Y0.
    N780 G90
    N790 A0.
    N800 M30
    %

    thanks for your help guys, would have been stuffed without you.
    :cheers:

  16. #16
    Join Date
    May 2004
    Posts
    4519
    I think pcom_moveb outputs the A.

  17. #17
    Join Date
    Dec 2008
    Posts
    3110
    pretract is the postblock that is done after each operation
    - and at the end of the program
    protretinc is the postblock for rotary return within the pretract block
    ---you have to follow each jump to fully understand how it works


    Code:
    pretract        #End of tool path, toolchange
          sav_absinc = absinc$ ( save mode )
          absinc$ = one    ( force mastercam into inremental  mode)
          sav_coolant = coolant$ ( save coolant status )
          coolant$ = zero ( force Coolant OFF )
    #      if nextop$ = 1003, #Uncomment this line to leave coolant on until eof unless
            [                 #  explicitely turned off through a canned text edit
            if all_cool_off,
              [
              #all coolant off with a single off code here
              if coolant_on, pbld, n$, sall_cool_off, e$
              coolant_on = zero
              ]
            else,
              [
              local_int = zero
              coolantx = zero
              while local_int < 20 & coolant_on > 0,
                [
                coolantx = and(2^local_int, coolant_on)
                local_int = local_int + one
                if coolantx > zero,
                  [
                  coolantx = local_int
                  pbld, n$, scoolantx, e$
                  ]
                coolantx = zero
                ]
              coolant_on = zero
              ]
            ]
          #cc_pos is reset in the toolchange here
          cc_pos$ = zero ( force cutter comp OFF ) 
          gcode$ = zero  ( force Rapid mode  )
          #pbld, n$, sccomp, *sm05, psub_end_mny, e$   ( stop spindle )
          pbld, n$, sccomp, "M9", psub_end_mny, e$        (Coolant OFF )
          pbld, n$, *sgcode, sgabsinc, *sg28ref, "Z0.", "M19", e$ ( Retract to machine Z origin, stop & orientate the spindle )
          if nextop$ = 1003 | tlchg_home,   ( is this the last operation ??..... skip bracketted section if NO )
              [
               pbld, n$, *sg28ref, "Y0.", e$  ( retract to machine Y origin )
               absinc$ = zero  ( force mastercam into absolute mode )
               pbld, n$, *sgcode, sgabsinc, protretinc, e$ ( force output of Rapid, Absolute, run the rotary return postblock )
              ]
          absinc$ = sav_absinc  ( set mastercam back to original mode before this postblock)
          coolant$ = sav_coolant ( set back to original coolant setting )
    I also suggest that you alter your toolchange program to include a G90 somewhere in the cycle, you could also incude a G94 ( Feed units per minute ) and a G80 ( cancel canned cycles) to make it a lot safer.

    You did notice that I don't have X origin return in the output, just Y.......tool only retracts for each toolchange, & the table will move to front door at end of program for operator to remove/load parts

  18. #18
    Join Date
    Jan 2010
    Posts
    321
    I did notice the y only move but as this is a knee mill with z on the quill having the vice and job way out the way of me manually changing tools appeals to me at the moment.

    when you say to alter the tc program i assume cause i dont have a auto tool changer this is not needed.??

    so how would you suggest i have my end of toolpath/program outputting???

    were would i put the g80?

    something like
    g91 g28 z0
    g28 x0 y0
    g90 g80
    a0

    not sure what you mean about the g94 tho. what will that do?

    sorry for the beginner type questions but this is all very new to me. alot to learn

  19. #19
    Join Date
    Dec 2008
    Posts
    3110
    Quote Originally Posted by Deano7/11 View Post
    I did notice the y only move but as this is a knee mill with z on the quill having the vice and job way out the way of me manually changing tools appeals to me at the moment.

    when you say to alter the tc program i assume cause i dont have a auto tool changer this is not needed.??
    - So what does the M6 do in your machine ???
    the M6 should be calling up a little macro, or just have a Z return (G0 G91 G28 Z0.) with a program stop ( M00 )

    so how would you suggest i have my end of toolpath/program outputting???

    were would i put the g80?

    something like
    g91 g28 z0
    g28 x0 y0
    g90 g80
    a0

    not sure what you mean about the g94 tho. what will that do?
    The G94 would be used as a safety code, so if you did any machining with a feed per revolution ie tapping, it would be changed back to your normal setting for milling

    I have mine output after any drill cycles, just to be safe
    - the * before the postblock actually forces the output to the NC file, even if it is a modal code.
    Code:
    pcanceldc$       #Cancel canned drill cycle
          result = newfs(three, zinc)
          z$ = initht$
          if cuttype = one, prv_zia = initht$ + (rotdia$/two)
          else, prv_zia = initht$
          pxyzcout
          !zabs, !zinc
          prv_gcode$ = zero
          pcan
          pcan1, pbld, n$, *sg80, *sg94, strcantext, e$
          #if drillcyc$ = 3, pbld, n$, sg94, e$
          pcan2
    IMO, the required output NC code before each toolchange you need is
    - I placed the modal G codes so you can see whatis actually active
    Code:
     
    G80 G94    ( this line outputs after any drill cycle )
    M5
    M9
    G0 G91 G28 Z0.
    G0 G91 G28 X0. Y0.
    G0 G90 A0.  ( the A0. can be omitted if you only have 3 axis )
    M1    (  optional stop, good for when proving off, or wanting the program to stop to inspect the cut, tool, part size etc.- by just flicking the OPT. STOP switch to ON )
    I would also NOT have the G49 ( cancel tool length ) output on the toolchange line, it doesn't do anything, as the next G43 will reset tool length

  20. #20
    Join Date
    Jan 2010
    Posts
    321
    ok i think i have got it now.
    i have left the A0 in at the end of the program as it doesn't hurt anything.
    i couldn't have a g0 and g28 on the same line (as in g0 g28 x0 y0) as mach3 said you cant have 2 gcodes that do something or other on the same line (some sort of error). so i ditched the g0 and that fixed the error.

    the m06 prompts the tool change number on the screen and the 'change tool and press cycle start' comment, tried it without the m06 and found this out.

    i played around more with the G58 as the position of getting the tool away from the job and not having the table go to home and worked out what i was doing wrong last night so have now got it sorted. the great thing is i can position the g58 position anywhere that is away from the job enough and can be set to a different position every job if required. so now have implemented this feature into the post.

    i removed the G49 from the tool change line. but it is still in on the second line of the program. i will leave it their i think. i took your advice on the g94 and i have entered it after a drill cycle. feed per rev at this stage wont be an issue as i don't think mach 3 does rigid tapping but it is now in the post.

    below is what is output from the post at the start of the program.

    N100 G21
    N110 G0 G17 G40 G49 G80 G90
    N120 T1 M6
    N130 G0 G90 G54 X-35. Y6. A0. S2046 M3
    N140 G43 H1 Z25.
    N150 Z10.

    below is end of a toolpath and start of a drilling cycle

    N290 G1 X-35.
    N300 G0 Z25.
    N310 M5
    N320 G91 G28 Z0.
    N330 G90 G58 X0 Y0
    N340 G0 G90 A0.
    N350 M01
    N360 T124 M6
    N370 G0 G90 G54 X10. Y10. A0. S300 M3
    N380 G43 H124 Z25.
    N390 G99 G81 Z-3. R25. F7500.

    and below this is at the end of a drill cycle and tool change

    N290 G1 X-35.
    N300 G0 Z25.
    N310 M5
    N320 G91 G28 Z0.
    N330 G90 G58 X0 Y0
    N340 G0 G90 A0.
    N350 M01
    N360 T124 M6
    N370 G0 G90 G54 X10. Y10. A0. S300 M3
    N380 G43 H124 Z25.


    and below is end of a drill cycle and also end of program.
    N690 G99 G81 Z-2. R25. F1389.9
    N700 G80 G94
    N710 M5
    N720 G91 G28 Z0.
    N730 G90 G58 X0 Y0
    N740 G0 G90 A0.
    N750 M30


    so what do you think?????

    about right??

Page 1 of 2 12

Similar Threads

  1. setting up new post
    By BurrMan in forum BobCad-Cam
    Replies: 8
    Last Post: 10-16-2012, 03:34 AM
  2. setting up a post in MC for my Prototrak MX2
    By NHPhil in forum Community Club House
    Replies: 2
    Last Post: 09-01-2010, 01:21 AM
  3. Could someone post there setting for a HY02D223B
    By Ed Williams in forum DIY CNC Router Table Machines
    Replies: 6
    Last Post: 05-20-2009, 06:23 PM
  4. Help setting up post process from TCC to Mach3
    By 56speedster in forum Uncategorised CAM Discussion
    Replies: 0
    Last Post: 03-29-2008, 04:14 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
  •