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:

tool number with letters and numbers


danm
 Share

Recommended Posts

You have a couple of ways to control this:

Via formatting, and parameters in the post, and/or in the tool definition.

Tool library would of course be required. 

Have you got the MP documentation?

Try a search too, I can't believe this hasn't been talked about in some form, perhaps not so extensive as you might want but at least a place to start.

Link to comment
Share on other sites

Looks suspiciously siemens. 

Are the two different formats for the same machine?  That's probably going to determine how you go about it and how much logic would be required.

If the tool call is always in the string call format T="ABCD1234" 

you can change your toolno fmt line to be an empty string "" instead of "T", then your tool change line would look like:

 pbld, n$, *sg28ref, "U0.", [if y_axis_mch, "V0."], "W0.", e$
          toolno = t$ * 100 + zero
          if home_type = m_one, pbld, n$, *sgcode, "T=", no_spc$, 34, no_spc, *strtool, no_spc$, *toolno, no_spc$, 34, e$
          else, pbld, n$, *sg50, pfxout, pfyout, pfzout, e$

you're strtool would have to be the ABCD and set by your tool description, or make a new string variable and pull the info from somewhere else. 

 

Link to comment
Share on other sites

The main issue you're going to have is that the Tool variable (t$) is a Numeric Variable, while you want to capture and output a String.

I would create a User-Defined variable, and not try to use t$ at all.

#First Define Variables

st_pre    : 'T="'
st_suf    : '"'
stoolname  : ""
stoolwarnout : ""
stoolwarn1 : "WARNING - TOOL NAME LESS THAN 2 CHARACTERS IN"
stoolwarn2 : "BE CAREFUL THAT YOUR NAME MATCHES THE MACHINE CONTROL."
fmt  "OP: "  4  op_num
sop_num

#Inside 'pparameter$', get the Operation Number

pparameter$
     if prmcode$ = 15240, op_num = rpar(sparameter$, 1)



#Then, concatonate the 'strtool$' variable into an output variable that has the proper strings.

psof$
   
      if strlen(strtool$) < two,
        [
        sop_num = drs_str(2, op_num) #Convert Op Number into 'dressed string'
        stoolwarnout = stoolwarn1 + no2asc(11) + no2asc(13) + sop_num + no2asc(11) + no2asc(13) + stoolwarn2
        mprint(stoolwarnout)
        ]
      stoolname = st_pre + strtool$ + st_suf #Build String
      pbld, n$, stoolname, "M06", e$
                                

 

Link to comment
Share on other sites

I borked mine a bit and then saw you wanted both formats in the same program. 

 pbld, n$, *sg28ref, "U0.", [if y_axis_mch, "V0."], "W0.", e$
          toolno = t$ 
          if home_type = m_one, pbld, 
			[
			if strlen(strtool$) < 1, n$, *sgcode, "T=", no_spc$, *toolno, e$  #because you may want to just post the tool number if there is no tool name
            else, n$, *sgcode, "T=", no_spc$, 34, no_spc, *strtool$, no_spc$, *toolno, no_spc$, 34, e$ #forgot the $
            ]
            else, pbld, n$, *sg50, pfxout, pfyout, pfzout, e$
                                    

 

Link to comment
Share on other sites
2 hours ago, danm said:

Kalibre, I finally had a little time to try this and I am not sure where to add this text. Do i put it in with the ptlchg$ ? And if this works can I put the letters in with the tool number on the parameters page?

run the debugger and watch where the post outputs the tc lines, put it in there. you won't be able to put the letters in the tool path parameters page. In the example, your post would pull it from the "Tool name" in the "Define tool" section. 

Link to comment
Share on other sites

Kalibre,

The sample you gave me has me close. I have been experimenting with the code and I am getting spaces in the output.

;T2215  - EMD2215              - DIA 25.4MM  - CORNER RAD 1.5
G0 T=" EMD2215"

I have  tried making minor changes but still cant seem to get rid of the spaces.

ptoolcall               #Tool change code
      
          toolno =t$ 
          #if home_type = m_one, pbld, 
            [
            if strlen(strtool$) < 1, n$, *sgcode, "T=",no_spc$,*toolno, e$  #because you may want to just post the tool number if there is no tool name
            else, n$, *sgcode, "T=", no_spc$,34, no_spc, *strtool$, no_spc$, *toolno, no_spc$,34 e$ #forgot the $
            ]
            pbld, pn, *smtlchg, pe, pms
            else, pbld, n$, *sg50, pfxout, pfyout, pfzout, e$

any help with where the spaces come from would be appreciated.

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