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:

Creating custom canned cycle, getting error


Recommended Posts

No idea what I'm missing here.

"RUN TIME -PST(1392)- The value of the string select selection variable is out of range:16"

I've greyed out every option in the menu but I'm still getting it. It's referencing this line of code.

pdrlcst8         #Broach cycle
      pdrlcommonb
      sopen_prn, "SPINDLE ORIENT", sclose_prn, "M19", e$
      pcan1, pbld, n$, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,    <----this line
        prdrlout, shftdrl$, *feed, strcantext, e$
      pcom_movea

 

dghrdg.png

Link to comment
Share on other sites

Your '*sgdrill' is the likely culprit. If you pasted the entire error message string, it should have something like [34] at the end of the error string. The number would change to indicate the specific "column number" where the error occurred. This is usually the start of a variable name.

The 'sgdrill' string select outputs the cycle number, but only 0-7 is setup in the table. Try replacing sgdrill, with a user-defined string.

 

Link to comment
Share on other sites
19 Dec 2019 08:08:45 AM - Report created.
19 Dec 2019 08:08:45 AM - Initialize posting log file
19 Dec 2019 08:08:45 AM - Using MP run version 20.00 and post components version 20.00
19 Dec 2019 08:08:45 AM - Initiate opening the post processor file(s).
19 Dec 2019 08:08:45 AM - C:\Users\Public\Documents\shared Mcam2018\mill\Posts\Mori MH-40 4axis Post.PST
19 Dec 2019 08:08:45 AM - The post processor file has been successfully opened.
19 Dec 2019 08:08:45 AM - Initialization of pre-defined post variables, strings, postblocks was successful.
19 Dec 2019 08:08:45 AM - Search for defined post variables, strings, postblocks was successful.
19 Dec 2019 08:08:45 AM - RUN TIME -PST(1390)- The value of the string select selection variable is out of range:16
19 Dec 2019 08:08:45 AM - Successful completion of posting process!

 

 

Link to comment
Share on other sites

Also, I'm assuming you meant this table? I tried adding to it, but nothing I tried worked.

 

usecandrill$ : yes$  #CD_VAR Use canned cycle for Drill
usecanpeck$  : yes$  #CD_VAR Use canned cycle for Peck
usecanchip$  : yes$  #CD_VAR Use canned cycle for Chip Break
usecantap$   : yes$  #CD_VAR Use canned cycle for Tap
usecanbore1$ : yes$  #CD_VAR Use canned cycle for Bore1
usecanbore2$ : yes$  #CD_VAR Use canned cycle for Bore2
usecanmisc1$ : yes$  #CD_VAR Use canned cycle for Misc1
usecanmisc2$ : yes$  #CD_VAR Use canned cycle for Peck Tapping

 

Link to comment
Share on other sites

No. String Select Tables are a different mechanism inside the Post entirely.

The String Select Table "selects a string, from a 'list of strings', based on the Numeric Value (and modality) of a numeric variable.

Basically, the mechanism uses an "integer" and (internally) compares the "current value" of the variable, to the "previous value" of the variable. If the values do not match, then the string is output. If the values "match", then no output occurs.

This, is the correct String Select Table for 'sgdrill':

# --------------------------------------------------------------------------
# Canned drill cycle string select
sg81    : "G81"      #drill      - no dwell
sg81d   : "G82"      #drill      - with dwell
sg83    : "G83"      #peck drill - no dwell
sg83d   : "G83"      #peck drill - with dwell
sg73    : "G73"      #chip break - no dwell
sg73d   : "G73"      #chip break - with dwell
sg84    : "G84"      #tap        - right hand
sg84d   : "G74"      #tap        - left hand
sg85    : "G85"      #bore #1    - no dwell
sg85d   : "G89"      #bore #1    - with dwell
sg86    : "G86"      #bore #2    - no dwell
sg86d   : "G86"      #bore #2    - with dwell
sgm1    : "G76"      #misc #1    - no dwell
sgm1d   : "G76"      #misc #1    - with dwell
sgm2    : "G81"      #misc #2    - no dwell
sgm2d   : "G82"      #misc #2    - with dwell
sgc9    : "G81"      #custom #9  - no dwell
sgc9d   : "G82"      #custom #9  - with dwell
sgdrill : ""         #Target for string

fstrsel sg81 drlgsel sgdrill 18 -1

 

And yes, I would recommend you just replace the:

     *sgdrill

with this:

      "G81"

 

Link to comment
Share on other sites

In this case, the variable that actually "controls" the string output is:

     drlgsel

Which, is set in the 'pdrlcommon' Post Block, based on the specific cycle you selected in the "drop down" menu.

However, there are only "Formatted Strings" for the first 8 Drill Cycles in the list. (Numbered 0 through 7)

So, when you start customizing the 8th cycle, through the 20th cycle, you have to add your own logic, and output statements. Often this requires either modifying the existing logic, or adding your own "custom" variables.

I would strongly caution you that it is very easy to "break" the architecture in your Post, if you don't really know how to make the edits correctly. So I'd stick with using "String Literals" (literally, a string wrapped in double quote marks (" "), separated by commas, on the output line).

I do appreciate that you are attempting to modify the Post, in order to support your needs. That is exactly how I started getting involved in Post Modifications, almost 20 years ago...

Be sure to create a "backup copy" (several actually, in different locations), so that you can always "recover" back to the beginning, if something gets broken, and you can't figure out why...

 

 

 

Link to comment
Share on other sites

Ahh, gotcha. And I see the number of options in the list must match that last line.

I appreciate the help and the guidance and I do take precautions, chief among which is actually understanding what I'm doing before I mess with it. Unfortunately, there's only so far you can go without having a book full of codes in front of you. Case in point; I never would have found out that "sgc*" is the code for the custom cycles if I didn't see you post it, because obviously that wasn't in my list already.

One last question, perhaps? Would you know how to get rid of the spindle speed command like how it's MIA for the "rigid tapping" cycle? I'm using this as a broaching cycle and would rather it not be there at all.

Link to comment
Share on other sites
47 minutes ago, Cavi Mike said:

Ahh, gotcha. And I see the number of options in the list must match that last line.

I appreciate the help and the guidance and I do take precautions, chief among which is actually understanding what I'm doing before I mess with it. Unfortunately, there's only so far you can go without having a book full of codes in front of you. Case in point; I never would have found out that "sgc*" is the code for the custom cycles if I didn't see you post it, because obviously that wasn't in my list already.

One last question, perhaps? Would you know how to get rid of the spindle speed command like how it's MIA for the "rigid tapping" cycle? I'm using this as a broaching cycle and would rather it not be there at all.

To affect the "Tool Change", we have to use a special Mechanism that is built into the MP Language.

MP is a "scripting language" at heart. This means that MP.DLL "opens the NCI file", and "scans through the file", processing "2-lines at a time".

Because of the way MP is "built" internally, you do not have the ability to "search forwards or backwards" in the NCI, to determine what is "coming up". That is the reason you are having an issue with the Spindle Speed not being output for Rigid Tap.

CNC Software built a mechanism into MP, which allows MP to "Pre-Read" the NCI File. This scans through the entire NCI, and captures "Tool Change values". Originally, this was built to allow you to create a Tool Table in the NC File Header.

At some point, the Pre-Read mechanism was enhanced to include the "Get Next Routine". The "Get Next" routine scans through the NCI file, during the Pre-Read, and populates a special set of "next value variables".

For Drill Cycles, this includes capturing a special variable, which is used to "peek ahead" during the Tool Change, to see "what Drill Cycle is coming up?". 

The variable you should reference inside the Tool Change is:

ne

      nextdc$

So your code (to suppress Spindle Speed output), would depend a bit on "what post you started working with".

For MPMaster, you would need to change 'pspindleout' and 'pfspindleout'.

Here are the original Post Blocks:

pspindleout     #Spindle speed and M code output
      if not((opcode$ = 3 | opcode$ = 16) & nextdc$ = 3 & rigid_tap), speed, spindle

pfspindleout     #Spindle speed and M code output forced
      if not((opcode$ = 3 | opcode$ = 16) & nextdc$ = 3 & rigid_tap), *speed, *spindle

Here are the modified Post Blocks:

pspindleout     #Spindle speed and M code output
      if not((opcode$ = 3 | opcode$ = 16) & ((nextdc$ = 3 & rigid_tap) | nextdc$ = 8)), speed, spindle

pfspindleout     #Spindle speed and M code output forced
      if not((opcode$ = 3 | opcode$ = 16) & ((nextdc$ = 3 & rigid_tap) | nextdc$ = 8)), *speed, *spindle

For a Generic Fanuc or Haas Post (from CNC Software), it would be in the 'psof$',  'ptlchg$', or 'ptlchg0$' blocks:

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$
        ]
      pbld, n$, *smetric, e$
      if convert_rpd$, pconvert_rpd
      pbld, n$, [if gcode$, *sgfeed], *sgcode, *sgplane, scc0, sg49, sg80, *sgabsinc, [if gcode$, *feed], 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$, sg92, *xh$, *yh$, *zh$, e$
        absinc$ = sav_absinc
        ]
      pcom_moveb
      pcheckaxis
      c_mmlt$ #Multiple tool subprogram call
      ptoolcomment
      comment$
      pcan
      pbld, n$, *t$, sm06, e$
      pindex
      if mi1$ > one, absinc$ = zero
      if use_rot_lock & (cuttype <> zero | (index = zero & prv_cabs <> fmtrnd(cabs))), prot_unlock
      if convert_rpd$, pconvert_rpd
      pcan1, pbld, n$, [if gcode$, *sgfeed], *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfcout,
        [if nextdc$ <> 7 | nextdc$ <> 8, *speed, *spindle], pgear, [if gcode$, *feed], strcantext, e$
      if use_rot_lock & cuttype = zero, prot_lock
      pbld, n$, sg43, *tlngno$, pfzout, pscool, pstagetool, e$
      absinc$ = sav_absinc
      pbld, n$, sgabsinc, e$
      pcom_movea
      toolchng = zero
      c_msng$ #Single tool subprogram call

For Null Tool Change, 'pspindlechng':

pspindchng      #Spindle speed change
      if prv_spdir2 <> spdir2 & prv_speed <> zero, pbld, n$, *sm05, e$
      if prv_speed <> speed | prv_spdir2 <> spdir2,
        [
        if speed & (nextdc$ <> 7 | nextdc$ <> 8), pbld, n$, *speed, *spindle, pgear, e$
        ]
      !speed, !spdir2

In 'ptlchg$':

ptlchg$          #Tool change
      pcuttype
      toolchng = one
      if mi1$ = one, #Work coordinate system
        [
        pfbld, n$, *sg28ref, "X0.", "Y0.", e$
        pfbld, n$, sg92, *xh$, *yh$, *zh$, e$
        ]
      if prog_stop = 1, pbld, n$, *sm01, e$
      if prog_stop = 2, pbld, n$, *sm00, e$
      pcom_moveb
      pcheckaxis
      c_mmlt$ #Multiple tool subprogram call
      ptoolcomment
      comment$
      pcan
      result = newfs(15, feed)  #Reset the output format for 'feed'
      pbld, n$, *t$, sm06, e$
      pindex
      sav_absinc = absinc$
      if mi1$ > one, absinc$ = zero
      if use_rot_lock & (cuttype <> zero | (index = zero & prv_cabs <> fmtrnd(cabs))), prot_unlock
      if convert_rpd$, pconvert_rpd
      pcan1, pbld, n$, [if gcode$, *sgfeed], *sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfcout,
        [if nextdc$ <> 7 | nextdc$ <> 8, *speed, *spindle], pgear, [if gcode$, *feed], strcantext, e$
      if use_rot_lock & cuttype = zero, prot_lock
      pbld, n$, sg43, *tlngno$, pfzout, pscool, pstagetool, e$
      absinc$ = sav_absinc
      pbld, n$, sgabsinc, e$
      pcom_movea
      toolchng = zero
      c_msng$ #Single tool subprogram call
      !xnci$, !ynci$, !znci$

 

Link to comment
Share on other sites
  • 3 weeks later...
On 12/19/2019 at 12:47 PM, Cavi Mike said:

Ahh, gotcha. And I see the number of options in the list must match that last line.

I appreciate the help and the guidance and I do take precautions, chief among which is actually understanding what I'm doing before I mess with it. Unfortunately, there's only so far you can go without having a book full of codes in front of you. Case in point; I never would have found out that "sgc*" is the code for the custom cycles if I didn't see you post it, because obviously that wasn't in my list already.

One last question, perhaps? Would you know how to get rid of the spindle speed command like how it's MIA for the "rigid tapping" cycle? I'm using this as a broaching cycle and would rather it not be there at all.

Here's a snippet of my broaching,

pdrlcst$         #Custom drill cycles 8 - 19 (user option)
      #Use this postblock to customize drilling cycles 8 - 19
      pdrlcommonb
      if drillcyc$ = 8, # broaching
        [
        if dwell$ = 0,
          [
          temp2_1 = x$ # cutting "X"
          temp2_2 = x$ - peckclr$ # retracting "X"
          pdrlcommonb
          n$, pdrlxy, e$
          n$, "M19", e$ #<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
          while temp2_1 <> drl_prm2$,
            [
            n$, sg01, "X", no_spc$, *temp2_1, feed, e$
            n$, *depth$, e$
            n$, sg00, "X", no_spc$, *temp2_2, e$
            n$, *refht$, e$
            temp2_1 = temp2_1 + peck1$
            if temp2_1 > retr$, temp2_1 = retr$
            ]
          ]

 

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