Sign in to follow this  
danm

tool number with letters and numbers

Recommended Posts

Is there a way to adjust our post to not only give us a 4 digit tool number but at times we also use letters to identify our tools. we currently get a standard 4 digit tool code. example

T1234

M6 

in some cases we would like 

T="ABC1234"

M6

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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. 

 

Share this post


Link to post
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$
                                

 

Share this post


Link to post
Share on other sites

Yes this is for a siemens. How the shop is set up we name tools by the holder so we could have different types of tool outputs in the same program.

 

Share this post


Link to post
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$
                                    

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • 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