Page 1 of 2 12 LastLast
Results 1 to 12 of 16

Thread: Adding M52 & M53 to Post Processor

  1. #1
    Registered
    Join Date
    Nov 2005
    Location
    USA
    Posts
    130
    Downloads
    0
    Uploads
    0

    Adding M52 & M53 to Post Processor

    Newbie here - how difficult is it to add the auto-door codes to the beginning & end of a post?


  2. #2
    Registered
    Join Date
    May 2004
    Location
    United States
    Posts
    4,519
    Downloads
    0
    Uploads
    0
    Easy. Example:

    Find the start of file section:

    psof$ #Start of file for non-zero tool number
    pcuttype
    toolchng = one
    if ntools$ = one,
    [
    #skip single tool outputs, stagetool must be on
    stagetool = m_one
    !next_tool$
    ]
    "%", e$
    *progno$, e$
    "(PROGRAM NAME - ", sprogname$, ")", e$
    "(DATE=DD-MM-YY - ", date$, " TIME=HH:MM - ", time$, ")", e$
    M52 (DOOR CLOSE) ;<<<This line added
    pbld, n$, *smetric, e$
    pbld, n$, *sgcode, *sgplane, "G40", "G49", "G80", *sgabsinc, e$
    sav_absinc = absinc$
    if mi1$ <= one, #Work coordinate system
    [
    absinc$ = one
    pfbld, n$, sgabsinc, *sg28ref, "Z0.", e$
    pfbld, n$, *sg28ref, "X0.", "Y0.", e$
    pfbld, n$, "G92", *xh$, *yh$, *zh$, e$
    absinc$ = sav_absinc
    ]
    pcom_moveb
    c_mmlt$ #Multiple tool subprogram call
    ptoolcomment
    comment$
    pcan
    if stagetool >= zero, pbld, n$, *t$, "M6", e$
    pindex
    if mi1$ > one, absinc$ = zero


    Then find the file end section:

    peof$ #End of file for non-zero tool
    pretract
    comment$
    #Remove pound character to output first tool with staged tools
    #if stagetool = one, pbld, n, *first_tool, e
    M53 (DOOR OPEN) ;<<<<This line added
    n$, "M30", e$
    mergesub$
    clearsub$
    mergeaux$
    clearaux$
    "%", e$

    Now, I would actually add the door close command before each tool call since you might actually restart a program some place other than the beginning. Just my thoughts.
    http://www.kirkcon.com/


  3. #3
    Registered
    Join Date
    Nov 2005
    Location
    USA
    Posts
    130
    Downloads
    0
    Uploads
    0

    What'd I do wrong?

    Well that seemed easy enough but the codes aren't showing up when posted. BTW - Generic Fanuc 2x lathe.PST


    "(", "MCX FILE - ", *smcpath$, *smcname$, *smcext$, ")", e$
    "(", "NC FILE - ", *spathnc$, *snamenc$, *sextnc$, ")", e$
    "(", "MATERIAL - ", *stck_matl$, ")", e$
    spaces$ = sav_spc
    M53 (DOOR CLOSE) ;
    pbld, n$, *smetric, e$


    peof$ #End of file for non-zero tool
    ptoolend$
    comment$
    M52 (DOOR OPEN) ;
    n$, "M30", e$
    mergesub$
    clearsub$
    mergeaux$
    clearaux$
    "%", e$


  4. #4
    Registered
    Join Date
    Nov 2005
    Location
    USA
    Posts
    130
    Downloads
    0
    Uploads
    0
    Never mind, I just needed to add quotation marks.

    I'd also like to try your suggestion to add the door closing at the beginning of each operation.


  • #5
    Registered
    Join Date
    May 2004
    Location
    United States
    Posts
    4,519
    Downloads
    0
    Uploads
    0
    Quote Originally Posted by Technical Ted View Post
    Never mind, I just needed to add quotation marks.

    I'd also like to try your suggestion to add the door closing at the beginning of each operation.
    Sorry, I forgot that it would try to read M53 and M54 as variables. Yeah, you have to have quotation marks for it to output as text. And actually to end the block it wants e$, not ;.

    To add it for each operation, look for the tool change:

    ltlchg$ #Toolchange, lathe
    toolchng = one
    gcode$ = zero
    copy_x = vequ(x$)
    pcc_capture #Capture LCC ends, stop output RLCC
    c_rcc_setup$ #Save original in sav_xa and shift copy_x for LCC comp.
    pcom_moveb #Get machine position, set inc. from c1_xh
    c_mmlt$ #Position multi-tool sub, sets inc. current if G54...
    ptoolcomment
    comment$
    "M53", e$#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<This line added
    if home_type < two, #Toolchange G50/home/reference position
    [
    sav_xh = vequ(copy_x)
    sav_absinc = absinc$
    absinc$ = zero
    pmap_home #Get home position, xabs
    ps_inc_calc #Set start position, not incremental
    #Toolchange home position
    if home_type = one,
    pbld, n$, *sgcode, pfxout, pfzout, e$
    else,
    [
    #Toolchange g50 position
    pbld, n$, *sg28ref, "U0.", "W0.", e$
    toolno = t$ * 100 + zero
    if home_type = m_one, pbld, n$, *sgcode, *toolno, e$
    else, pbld, n$, *sg50, pfxout, pfzout, e$
    ]
    pe_inc_calc #Update previous
    absinc$ = sav_absinc
    copy_x = vequ(sav_xh)
    ]
    toolno = t$ * 100 + tloffno$
    pbld, n$, *sgcode, *toolno, e$
    pcom_moveb #Reset machine position, set inc. from last position
    pcan
    pspindle
    #Added for 'css_start_rpm' logic (01/10/03)
    if css_actv$,
    [
    if css_start_rpm,
    prpm # Direct RPM startup for programmed CSS
    else,
    pbld, pcssg50, pcss # NO RPM start - just output the CSS
    ]
    else, # Direct RPM was programmed
    [
    prpm # Output programmed RPM
    ]
    sav_absinc = absinc$
    if home_type > one, absinc$ = zero
    pcan1, pbld, n$, psccomp, *sgcode, pwcs, pfxout, pfzout,
    pscool, strcantext, e$
    if lcc_cc_pos, plcc_cc_pos #Use sav_xa to position with comp. LCC
    pcom_movea #Update previous, pcan2
    ps_inc_calc #Reset current
    absinc$ = sav_absinc
    #Added for 'css_start_rpm' logic (01/10/03)
    if css_start_rpm,
    pbld, pcssg50, pcss # CSS output AFTER a G97S???? RPM spindle startup
    c_msng$ #Position single-tool sub, sets inc. current if G54...
    toolchng = zero
    http://www.kirkcon.com/


  • #6
    Registered
    Join Date
    Nov 2005
    Location
    USA
    Posts
    130
    Downloads
    0
    Uploads
    0
    Works great! Looks like I can now remove the 1st M53 we added. There's two more changes I'd like to make. Ist one should be easy, remove T0100, T0300, etc at the end of each operation. The 2nd one might be more difficult, Add N010, N020, etc at the beginning of each operation.


    O0061
    (PROGRAM NAME - POST TEST)
    (DATE=DD-MM-YY - 26-02-12 TIME=HH:MM - 15:30)
    (MCX FILE - C:\MCAMX\MCX\POST TEST.MCX)
    (NC FILE - C:\MCAMX\LATHE\NC\POST TEST.NC)
    (MATERIAL - STEEL INCH - 1030 - 200 BHN)
    M53
    G20
    (TOOL - 1 OFFSET - 1)
    (MCLNL INSERT - CNMG-433)
    M53
    G0 T0101
    G97 S411 M04
    G0 G54 X3.72 Z.07
    M8
    G50 S1000
    G96 S400
    G99 G1 X-.0938 F.012
    G0 Z.17
    X3.72
    Z.01
    G1 X-.0938
    G0 Z.11
    X3.27
    G1 Z-5.6269
    X3.52
    X3.6614 Z-5.5562
    G0 Z.11
    X3.02
    G1 Z-3.1183
    X3.0767 Z-3.1467
    G3 X3.11 Z-3.1869 R.0569
    G1 Z-5.6269
    X3.29
    X3.4314 Z-5.5562
    G0 Z.11
    X2.77
    G1 Z-3.07
    X2.8763
    G3 X2.9567 Z-3.0867 R.0569
    G1 X3.04 Z-3.1283
    X3.1814 Z-3.0576
    G0 Z.11
    X2.52
    G1 Z.01
    Z-3.0669
    G2 X2.5218 Z-3.0691 R.0031
    X2.5263 Z-3.07 R.0031
    G1 X2.79
    X2.9314 Z-2.9993
    G0 Z.1098
    X2.4355
    G1 Z-.0211
    X2.52 Z-.0633
    X2.6614 Z.0074
    M9
    G28 U0. W0. M05
    T0100
    M01
    (TOOL - 3 OFFSET - 3)
    (MWLNL INSERT - WNMG-432)
    M53
    G0 T0303
    G97 S720 M04
    G0 G54 X2.651 Z0.
    M8
    G50 S1000
    G96 S500
    G1 X-.0625 F.006
    G0 Z.1
    X2.97
    Z-2.979
    G1 Z-3.079
    X2.5755
    G3 X2.5363 Z-3.0709 R.0278
    G1 X2.6777 Z-3.0002
    G0 Z.1135
    X2.3564
    G1 Z.0135
    X2.4817 Z-.0492
    G3 X2.5 Z-.0712 R.0313
    G1 Z-3.0513
    G2 X2.5168 Z-3.0716 R.0288
    X2.5575 Z-3.08 R.0288
    G1 X2.9075
    G3 X2.9517 Z-3.0892 R.0313
    G1 X3.0717 Z-3.1492
    G3 X3.09 Z-3.1713 R.0313
    G1 Z-5.6113
    X3.2314 Z-5.5405
    M9
    G28 U0. W0. M05
    T0300
    M01
    (TOOL - 5 OFFSET - 5)
    (CENTER DRILL- .25 DIA.)
    M53
    G0 T0505
    G97 S1000 M03
    G0 G54 X0. Z.1
    M8
    G1 Z-.278 F.003
    G0 Z.1
    M9
    G28 U0. W0. M05
    T0500
    M52
    M30
    %


  • #7
    Registered
    Join Date
    May 2004
    Location
    United States
    Posts
    4,519
    Downloads
    0
    Uploads
    0
    This is a little tougher because there are several places in the post processor where the tool number with no offset is output. The line that sets up this output is:

    toolno = t$ * 100 + zero

    Not:

    toolno = t$ * 100 + tloffno$

    The line(s) that actually output include the variable:

    *toolno

    You will need to search through the post processor and find the above lines when they occur sequentially and make appropriate revision. Find similar to:

    toolno = t$ * 100 + zero
    if home_type = m_one, pbld, n$, *sgcode, e$

    I always like to copy the existing line and then comment it out with an appropriate note then add the revised line back in just below the comment.

    toolno = t$ * 100 + zero
    #if home_type = m_one, pbld, n$, *sgcode, *toolno, e$ (Removed tool number output)
    if home_type = m_one, pbld, n$, *sgcode, e$

    Do not change lines that include:

    toolno = t$ * 100 + tloffno$

    Next post will deal with line numbers.
    http://www.kirkcon.com/


  • #8
    Registered
    Join Date
    May 2004
    Location
    United States
    Posts
    4,519
    Downloads
    0
    Uploads
    0
    Output of line numbers depends on two factors. One is in the Control Definition. In the Control Definition Manager, you will need to turn on output of sequence numbers and adjust the first number and increment to your liking. Then in the post processor, you will need to remove output of all line numbers n$, except at the locations you wish them. In your case, I assume you will only want line numbers at your door close command.

    n$, "M53", e$
    Attached Thumbnails Attached Thumbnails Adding M52 &amp; M53 to Post Processor-controldefinitionedit.jpg  
    http://www.kirkcon.com/


  • #9
    Registered
    Join Date
    Nov 2005
    Location
    USA
    Posts
    130
    Downloads
    0
    Uploads
    0
    Got rid of the unwanted tool numbers.

    pl_retract #Retract tool based on next tool gcode, lathe (see ptoolend)
    cc_pos$ = zero
    if home_type = one,
    [
    pmap_home #Get home position, xabs
    ps_inc_calc #Set inc.
    pbld, n$, psccomp, e$
    pcan1, pbld, n$, *sgcode, pfxout, pfzout, *toolno, strcantext, e$
    pbld, n$, pnullstop, e$
    ]
    else,
    [
    #Retract to reference return
    pbld, n$, `sgcode, psccomp, e$
    if home_type = m_one, pbld, n$, *toolno, e$
    pcan1, pbld, n$, *sg28ref, "U0.", "W0.",
    pnullstop, strcantext, e$
    if home_type > m_one, pbld, n$, (*toolno, e$) <<<<<<<<<<<<<<<<< added parentheses
    ]


    peof0$ #End of file for tool zero
    peof$


  • #10
    Registered
    Join Date
    May 2004
    Location
    United States
    Posts
    4,519
    Downloads
    0
    Uploads
    0
    Ok. So, what do you think of post editing now?
    http://www.kirkcon.com/


  • #11
    Registered
    Join Date
    Nov 2005
    Location
    USA
    Posts
    130
    Downloads
    0
    Uploads
    0
    It's pretty cool that you can make some changes & get the output exactly the way you want it. I've only scatched the surface but it's not really that hard to make these type of changes. The toughest part might be finding the line you want to change in 58 pages of code. Thanks for all the help, I wouldn't have known where to start without someone pointing me in the right direction. Here's what I've got so far. Somewhere along the line I lost spaces between the output.

    %
    O0061
    (PROGRAM NAME - POST TEST)
    (DATE=DD-MM-YY - 26-02-12 TIME=HH:MM - 21:15)
    (MCX FILE - C:\MCAMX\MCX\POST TEST.MCX)
    (NC FILE - C:\MCAMX\LATHE\NC\POST TEST.NC)
    (MATERIAL - STEEL INCH - 1030 - 200 BHN)
    G20
    N10(TOOL - 1 OFFSET - 1)
    (MCLNL INSERT - CNMG-433)
    M53
    G0T0101
    G97S411M04
    G0G54X3.72Z.07
    M8
    G50S1000
    G96S400
    G99G1X-.0938F.012
    G0Z.17
    X3.72
    Z.01
    G1X-.0938
    G0Z.11
    X3.27
    G1Z-5.6269
    X3.52
    X3.6614Z-5.5562
    G0Z.11
    X3.02
    G1Z-3.1183
    X3.0767Z-3.1467
    G3X3.11Z-3.1869R.0569
    G1Z-5.6269
    X3.29
    X3.4314Z-5.5562
    G0Z.11
    X2.77
    G1Z-3.07
    X2.8763
    G3X2.9567Z-3.0867R.0569
    G1X3.04Z-3.1283
    X3.1814Z-3.0576
    G0Z.11
    X2.52
    G1Z.01
    Z-3.0669
    G2X2.5218Z-3.0691R.0031
    X2.5263Z-3.07R.0031
    G1X2.79
    X2.9314Z-2.9993
    G0Z.1098
    X2.4355
    G1Z-.0211
    X2.52Z-.0633
    X2.6614Z.0074
    M9
    G28U0.W0.M05
    M01
    N20(TOOL - 3 OFFSET - 3)
    (MWLNL INSERT - WNMG-432)
    M53
    G0T0303
    G97S720M04
    G0G54X2.651Z0.
    M8
    G50S1000
    G96S500
    G1X-.0625F.006
    G0Z.1
    X2.97
    Z-2.979
    G1Z-3.079
    X2.5755
    G3X2.5363Z-3.0709R.0278
    G1X2.6777Z-3.0002
    G0Z.1135
    X2.3564
    G1Z.0135
    X2.4817Z-.0492
    G3X2.5Z-.0712R.0313
    G1Z-3.0513
    G2X2.5168Z-3.0716R.0288
    X2.5575Z-3.08R.0288
    G1X2.9075
    G3X2.9517Z-3.0892R.0313
    G1X3.0717Z-3.1492
    G3X3.09Z-3.1713R.0313
    G1Z-5.6113
    X3.2314Z-5.5405
    M9
    G28U0.W0.M05
    M01
    N30(TOOL - 5 OFFSET - 5)
    (CENTER DRILL- .25 DIA.)
    M53
    G0T0505
    G97S1000M03
    G0G54X0.Z.1
    M8
    G1Z-.278F.003
    G0Z.1
    M9
    G28U0.W0.M05
    M52
    M30
    %


  • #12
    Registered
    Join Date
    May 2004
    Location
    United States
    Posts
    4,519
    Downloads
    0
    Uploads
    0
    I hope you were making back up copies as you were making changes. You should be able to retrace your steps and find where you lost your spaces. Spaces are to make it easier for humans to read. The CNC does not care.

    Looks good what you have so far.
    http://www.kirkcon.com/


  • Page 1 of 2 12 LastLast

    Similar Threads

    1. Need Help!- Help adding condition to Post for V24 Turn
      By brentworks in forum BobCad-Cam
      Replies: 10
      Last Post: 02-12-2012, 02:57 PM
    2. Adding operation title to post
      By AiR_GuNNeR in forum EdgeCam
      Replies: 2
      Last Post: 10-10-2011, 09:13 AM
    3. Need Help!- Adding 4th axis to post
      By 337MPH in forum Esprit
      Replies: 2
      Last Post: 03-25-2009, 09:22 AM
    4. Need Help!- Adding stock size to a post... not working the way I want
      By DaOne in forum Post Processors for MC
      Replies: 6
      Last Post: 09-22-2008, 06:53 PM
    5. Help with adding subprograms to post processor
      By creep_pea in forum Post Processors for MC
      Replies: 9
      Last Post: 11-13-2006, 11:56 AM

    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.