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:

Noob help editing generic post


Recommended Posts

Looking for some insight on editing the generic Fanuc 4x horizontal post... I need to have it do a few things:

 

 1. Post B axis unclamp/clamp codes (M11,M10)

 2. I need to force it to post H1, D1 for all the tool offsets/cutter comp values.

 3. Post an N number only at the start of each tool (based on it number, T20 would have an N20)

 

That is about it for now, at least enough to get me going ok. Thanks for any help.

  • Like 1
Link to comment
Share on other sites
 

I got it to post this :

N108 M11N110 B0N112 M10N114 G0 G90 G55 X-10.2999 Y9.4001 S9500 M3

I want it to post:

 

M11

G0 G90 G55 X-10.2999 Y9.4001 B0. S9500 M3

M10

Hi NFab,

  Go to CONTROL DEFINITION MANAGER, then click on NC OUTPUT, then uncheck OUTPUT SEQUENCE NUMBERS. 

 

if you want B0., then go to the post and look for this line

 

# --------------------------------------------------------------------------
# Tooltable Output
# --------------------------------------------------------------------------
pwrtt$      # Write tool table, scans entire file, null tools are negative
           if rotaxis$ > 0 | rotary_type$ > 0 | mill5$ <> 0,
             [
             sav_rot_on_x = rot_on_x
             output_z = yes$
             ]
           if vmc = 0 & tlplnno$ <> 2, sav_rot_on_x = rot_on_x
           if vmc = 1 & tlplnno$ > 1, sav_rot_on_x = rot_on_x
           sav_rot_on_x = rot_on_x    # B0. Here           

 

 

I hope this little trick would solve your problem.

Link to comment
Share on other sites

Look at the debugger it will help you a lot here.

Ok, I will have a look there. I am new with editing posts, never looked at one before..

 

 

 

Hi NFab,

  Go to CONTROL DEFINITION MANAGER, then click on NC OUTPUT, then uncheck OUTPUT SEQUENCE NUMBERS. 

 

if you want B0., then go to the post and look for this line

 

# --------------------------------------------------------------------------
# Tooltable Output
# --------------------------------------------------------------------------
pwrtt$      # Write tool table, scans entire file, null tools are negative
           if rotaxis$ > 0 | rotary_type$ > 0 | mill5$ <> 0,
             [
             sav_rot_on_x = rot_on_x
             output_z = yes$
             ]
           if vmc = 0 & tlplnno$ <> 2, sav_rot_on_x = rot_on_x
           if vmc = 1 & tlplnno$ > 1, sav_rot_on_x = rot_on_x
           sav_rot_on_x = rot_on_x    # B0. Here           

 

 

I hope this little trick would solve your problem.

 

The sequence number works, but it doesnt save it in the control definition? Any reason why? 

Link to comment
Share on other sites

Problem is that is not just a simple request depending on the post. There is the way the post is laid out that controls the way the code is output. Many different posts can handle this with a basic call, a common call, a locked behind the .psb call or any other way. Lets take X8 MPMASTER and use it for the example.

ptlchg_com      #Tool change common blocks
      if force_output | sof,
        [
        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$, *t$, "M06", ptoolcomm, e$
          ]
        else, pbld, n$, *t$, "M06", ptoolcomm, e$
        ]
      spaces$=0
      if output_z = yes$,
        [
        preadbuf5
        if (opcode$ > 0 & opcode$ < 16) | opcode$ = 19,
          [
          n$, pspc, scomm_str, "MAX - ", *max_depth, scomm_end, e$
          n$, pspc, scomm_str, "MIN - ", *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], 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, pfspindleout, [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,
          pfspindleout, [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, next_tool$, 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
      plast

That section gets called from the psof$. How do I know that? I can use the debugger and click on a line of code and it will show me what part of the post output the line.

 

The start of all of that is the condition statement if safe_index. Again you do a search of this using find and you will see this is a switch in the post to control posting behavior. Here is what the post says about how to use it.

safe_index   : 0    #Currently hooked up to misc int 4, remove safe_index = mi4$ from pmiscint$ to make this switch permanent

Now in that section you have some more condition statements. The condition statement to call the index output codes is coming from the line if lock_codes = 1. Up in the post the variable to use lock codes was activated. Now every where you see this condition statement the output of lock codes for the indexing axis will be output. That code could be an on or off of the lock codes. The logic is not written to track if it is on or off. It is turned off or on by brute force with sunlock is M11 and slock is M10. In this section you have to break down what line is calling what you want to change.

 

The line of the post that is outputting the index move is this line:

        pcan1, pbld, n$, *sgcode, sgplane, [if not(index), sgabsinc, pwcs], pfcout, strcantext, e$

The line of code that is outputting the X,Y and spindle speed and direction are this line:

        pbld, n$, sgcode, [if gcode$ = 1, sgfeed], pfxout, pfyout, pfspindleout, [if gcode$ = 1, *feed], e$

Then you see the else. That is the next part of the condition statement. Had the operation not used mi4$ to trigger a safe index or the post was not modified to always do a safe index then the else would become the active way the code will be output.

      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,
          pfspindleout, [if gcode$ = 1, *feed], strcantext, e$
        if lock_codes = one & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock, slockcomm, e$
        ]

This way would output code like you are asking for with the Lock code before the place you want it and the line of code would have everything like you are asking for. The you would have the lock codes come after the line you want.

 

Again without seeing how the post is configured and without knowing the exact structure it will be hard to know how to point you in the right direction. Hopefully this sheds some light on the complexity of posts, but also the simplicity of them if you just take the time to read the process, follow it and break it down to it's basic structure.

 

HTH(Hope that Helps)

Link to comment
Share on other sites

The sequence number works, but it doesnt save it in the control definition? Any reason why? 

 

How did you make the change to the control definition?  If you made the change through the operation manager by clicking file then edit it will only save it for that file.  To make a global change to the control def you will have to make the change through settings.   Not sure if all these steps are necessary but I first select design as the machine type then click new file.  The I click settings then machine definition manager.  Once in the machine def. manager I click the button to enter the control def. manager.  I make my changes then hit the save button.  Then I exit the control def manager to go back to the machine def. manager were I also click save and then exit.  Then any new file you start will use the new control def.  If you have an existing file you will have to reload the machine def. for the changes to take affect.

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...