Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Post out subprogram from main toopath


Recommended Posts

Hi,

 

I would like to be able to post my main programs like a subprogram shown below. Is there a reference that would help me do this? Can it be done without using transform toolpath?

 

Thank You

 

%

O1000 ( PROGRAM - MILL 6 )

N10 ( DATE - 01-07-11 TIME - 15:42 )

N20 G20

N30 G0 G17 G40 G80 G90 G94 G98

N40 G0 G28 G91 Z0.

N50 G0 G28 X0. Y0.

N60 ( TOOL - 1 DIA. OFF. - 1 LEN. - 1 DIA. - .5 )

( 5 - AXIS TABLE - HEAD VERTICAL )

( MACHINE GROUP-2 )

N70 T1

N80 M6

N90 G0 G54 G90 X-1.15 Y.3 C0. B0. S3056 M3

N100 G43 H1 Z.25

N110 Z.2

N120 G1 Z-.25 F24.45

N130 G41 D1 X-1.45 F48.9

M98 P1001

N210 M5

N220 G0 G28 G91 Z0.

N230 G28

N240 M01

N250 G0 G17 G40 G80 G90 G94 G98

N260 G0 G28 G91 Z0.

N270 ( TOOL - 2 DIA. OFF. - 2 LEN. - 2 DIA. - .375 )

( 5 - AXIS TABLE - HEAD VERTICAL )

( MACHINE GROUP-2 )

N280 T2

N290 M6

N300 G0 G54 G90 X4.225 Y-.6375 C0. B0. S4074 M3

N310 G43 H2 Z.25

N320 Z.2

N330 G1 Z-.25 F32.59

N340 G41 D2 Y-.4125 F65.18

M98 P1002

N430 M5

N440 G0 G28 G91 Z0.

N450 G0 G28 X0. Y0.

N460 G28

N470 M30

 

O1001

N140 G3 X-1.75 Y0. J-.3

N150 I1.75

N160 X-1.7471 Y-.0999 I1.75

N170 X-1.4305 Y-.3823 I.2995 J.0171

N180 G1 G40 X-1.131 Y-.3652

N190 Z-.05 F24.45

N200 G0 Z.25

M99

 

O1002

N350 G3 X4. Y-.1875 I-.225

N360 G1 X0.

N370 G2 X-.1624 Y-.0938 J.1875

N380 G1 X-2.1624 Y3.3704

N390 G3 X-2.4697 Y3.4527 I-.1948 J-.1125

N400 G1 G40 X-2.6646 Y3.3402

N410 Z-.05 F32.59

N420 G0 Z.25

M99

%

Link to comment
Share on other sites

Question is what have you tired?

 

Yes it can do it, but if you did a search you would find a ton of information explaining what you just asked about.

 

 

I have tried two post that give me what I want. One is the Generic Fanuc 5axis and the other is the download from here called mpsubrepx post.

 

I am not sure how many places and what needs to be added and what needs to be over written when I copy from the mpsubrepx to the Generic 5axis which I already renmamed so I have a backup.

 

So far I have located the statement "if numsub" would it be correct that all data that is written in reference to that statement would be my only value I should search and cross reference?

 

Thank You

Link to comment
Share on other sites

This is how I'm doing it in my 4ax post. Similar to mpsubrep. Mi1$ is the trigger Mi2$ is globally assigned to sub_offsets to output reps.

 

Here are the calls:

Entry point

ptlchg_com      #Tool change common blocks  
     #if force_output | sof,
     if force_output,
       [
       result = force(ipr_type,ipr_type)
       result = force(absinc$,absinc$)
       result = force(plane$,plane$)
       ]
     pcom_moveb
     pcheckaxis      #Check for valid rotary axis
     c_mmlt$ #Multiple tool subprogram call
     #ptoolcomment
     if sof & scomm_sav <> snull,
       [
       spaces$ = 0
       n$, pspc, scomm_str, *scomm_sav, scomm_end, e$
       spaces$ = sav_spc
       ]
     if sof = 0, scomm_sav = snull
     comment$
     pcomment3
     pmisccheck
     pcan
     if stagetool >= zero,
       [
       if omitseq$ = 1 & tseqno > 0,
         [
         if tseqno = 2, n$ = t$
         pbld, *n$, e$
         pbld, *t$, "M6", ptoolcomm, e$
         ]
       else, pbld, n$, *t$, "M6", ptoolcomm, e$
       ]
     spaces$=0
     if output_z = yes$,
       [
       preadbuf5
       if (opcode$ > 0 & opcode$ < 16) | opcode$ = 19,
         [
         #n$, pspc, scomm_str, "CLEAR HEIGHT - ", *max_depth, scomm_end, e$
         n$, pspc, scomm_str, "MAX DEPTH - ", *min_depth, scomm_end, e$
         ]
       ]
     spaces$=sav_spc
     pstock
     if plane$ < 0 | opcode$ = 3 | opcode$ = 16, plane$ = 0
     sav_absinc = absinc$
     if wcstype > one, absinc$ = zero
     pindex
     if safe_index,
       [
       if lock_codes = one & not(index) & rot_on_x, pbld, n$, *sunlock, sunlockcomm, e$
       pbld, n$, pgear, e$
       pcan1, pbld, n$, *sgcode, sgplane, [if not(index), sgabsinc, pwcs], pfspeedout, scoolant, pfcout, strcantext, e$
       if lock_codes = one & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock, slockcomm, e$
       if convert_rpd$ = one,
         [
         gcode$ = one
         feed = maxfeedpm
         ipr_type = zero
         ]
       pbld, n$, sgcode, [if gcode$ = 1, sgfeed], pfxout, pfyout, [if gcode$ = 1, *feed], e$
       ]
     else,
       [
       if lock_codes = one & not(index) & rot_on_x, pbld, n$, *sunlock, sunlockcomm, e$
       pbld, n$, pgear, e$
       if convert_rpd$ = one,
         [
         gcode$ = one
         feed = maxfeedpm
         ipr_type = zero
         ]
       pcan1, pbld, n$, *sgcode, sgplane, [if not(index), sgabsinc, pwcs], [if gcode$ = 1, sgfeed],
        pfcout, pfxout, pfyout, pfspeedout, scoolant, [if gcode$ = 1, *feed], strcantext, e$
       if lock_codes = one & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock, slockcomm, e$
       ]
     phsm1_on        #must remain before G43
     #pbld, n$, "G43", *tlngno$, pfzout, scoolant, pfspindleout, next_tool$, e$
     #Set bias
     if absinc$ = zero,
     local_z = zabs - bias
     else,
     local_z = zinc - bias
     #
     pbld, n$, "G91", "G43", *tlngno$, *local_z, pfspindleout, next_tool$, e$
     pbld, n$, "G92", pfzout, scoolant, e$
     #pbld, n$, "G92", pfzout, e$
     pcan2
     pbld, n$, "G90",  e$
     #pcan2           #Added so M and G codes in canned text will output before phsm2_on
     phsm2_on        #must remain after G43
     sav_coolant = coolant$
     if coolant$ = 1, sm09 = sm09_0
     if coolant$ = 2, sm09 = sm09_1
     if coolant$ = 3, sm09 = sm09_2
     absinc$ = sav_absinc
     pcom_movea
     toolchng = zero
     c_msng$ #Single tool subprogram call
     ptool_sub_s    # <------------------------------------------------tool sub start
     plast

Exit point

pretract        #End of tool path, toolchange
     phsm_off
     sav_absinc = absinc$
     absinc$ = one
     sav_coolant = coolant$
     ptool_sub_e #<-----------------------  tool sub end
     coolant$ = zero
     pbld, n$, strcantext, scoolant, e$

#      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,
           [
           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
     if convert_rpd$ = one,
       [
       gcode$ = one
       feed = maxfeedpm
       ipr_type = zero
       ]
     else, gcode$ = zero
     #pbld, n$, sccomp, *sm05, psub_end_mny, e$
     pbld, n$, sccomp, psub_end_mny, e$
     pbld, n$, sgabsinc, sgcode, [if gcode$ = 1, sgfeed], *sg28, "Z0", "M19", [if gcode$ = 1, feed], scoolant, e$
     #if lock_codes = one & rot_on_x, pbld, n$, *sunlock, sunlockcomm, e$
     #pbld, n$, *sg28, "X0", "Y0", protretinc, e$
     #if lock_codes = one & rot_on_x & cuttype = 0, pbld, n$, *slock, slockcomm, e$
     if abs(fmtrnd(cabs)) > 360 & nextop$ <> 1003 & not(index),
       [
       if lock_codes = one, pbld, n$, *sunlock, sunlockcomm, e$
       rotretflg = 1
       pbld, n$, `sg28, protretinc, e$
       rotretflg = 0
       if lock_codes = one & cuttype = 0, pbld, n$, *slock, slockcomm, e$
       ]
     absinc$ = sav_absinc
     coolant$ = sav_coolant

 

 

Here are the postblocks called

 

psub_st_s$       #Header in sub level
     result = nwadrs(stro, sub_prg_no$)
     spaces$ = 0
     sub_ext = sub_prg_no$
     *sub_prg_no$," (", s_progname, *sub_ext, "..SP", ")", e$
     [if scomm_sav <> snull, scomm_str, *scomm_sav, scomm_end], e$     #adding comment to the sub line makes it show up on the control 
     spaces$ = sav_spc
     pbld, n$, sgabsinc, e$
     result = force(gcode$,gcode$)


psub_end_s$      #End in sub level
     spaces$ = 0
     pbld, n$, "(", s_progname, *sub_ext, ")", e$
     spaces$ = sav_spc
     n$, "M99", e$
     prv_absinc$ = -1

# --------------------------------------------------------------------------
# Custom post blocks - Subprograms by tool
# --------------------------------------------------------------------------

ptool_sub_s  # Start Toolpath Sub  
   if mi1$ = 1,
   [
       pcust_call_s
       spaces$ = 0
       result = workofs$
       counter = sub_offsets - 1
       while counter > 0,
         [
         workofs$ = workofs$ + 1
         pfbld, n$, pwcs, e$
         pfbld, prpt_call_2, e$
         counter = counter - 1
         ]
   workofs$ = result
   !workofs$
   subout$ = 1
   psub_st_s$
   pbld, n$, pfxout, pfyout, e$
   ]
   spaces$ = sav_spc

ptool_sub_e  # End Toolpath Sub
   if mi1$ = 1,
   [
   psub_end_s$
   subout$ = 0
   ]

pdrlcst_sub_s  # Start Custom Drill Sub  
       if mi10$ = 0,
       [
       pcust_call_s
       subout$ = 3
       psub_st_s$
       ]

pdrlcst_sub_e  # End Custom Drill Sub
       if mi10$ = 0,
       [
       psub_end_s$
       if mi1$ = 1, subout$ = 2
       else, subout$ = 0
       ]

prpt_call_2
       sub_prg_call = sub_prg_no$
       pbld, n$, "M98 ", *sub_prg_call, e$

 

 

 

 

Link to comment
Share on other sites

Personally, I think transform is alot easier.

 

If you ask your reseller, they can email you a copy of the post ref guide. Look at the subout$ command and how it allows you to switch output streams.

 

Keep in mind that if you output subs this way, you won't be able to use non-transform subs like depth cuts and drill point subs.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...