mustardcam

Tool manufacturers code output to G code

Recommended Posts

Hey Team, 

I am trying to output the Tool manufacturers code from the tool settings into the G code. I have it working when the tool code is numerical but when the tool code has letters in the code it stops outputting after the Tool manufacturers code after the first letter is hit. 

 

ex. 78987t8987    post will output 78987 and stop. 

pardon the bad coding I am hacking and learning as I go.

Thanks in advance.  

fmt  "TC=" 25 groupcom     # out put the tool_op$ Manufactuers code
if prmcode$ = 20002, groupcom = rpar(sparameter$, 50)

(Pheader)

sopen_prn, *groupcom, sclose_prn, e$

 

 

Share this post


Link to post
Share on other sites
1 hour ago, mustardcam said:

 

 

Hey Team, 

I am trying to output the Tool manufacturers code from the tool settings into the G code. I have it working when the tool code is numerical but when the tool code has letters in the code it stops outputting after the Tool manufacturers code after the first letter is hit. 

 

ex. 78987t8987    post will output 78987 and stop. 

pardon the bad coding I am hacking and learning as I go.

Thanks in advance.  



 
if prmcode$ = 20002, groupcom = rpar(sparameter$, 50)

(Pheader)

sopen_prn, *groupcom, sclose_prn, e$

 

 

You are defining groupcom as a numeric variable with this

fmt "TC=" 25 groupcom # out put the tool_op$ Manufactuers code

 

Try like this instead to define it as a string

groupcom    :   "  "  # out put the tool_op$ Manufactuers code

 

 

You are defining the t

Share this post


Link to post
Share on other sites

now I get this output from the post and it still falls over when it sees letters, apart from the Groupcom it's pulling in from somewhere. 

 

(groupcom 2568542.)

Share this post


Link to post
Share on other sites

MP has two data types, string and numeric.  Strings always start with 's' and are initialized with quote characters (single or double).  The data coming from the 20002 is a string, so try this....

s_group_com : ""

pparameter$
    if prmcode$ = 20002, s_group_com = sparameter$

 If you'd like the "TC=" prefix you can build a string with a global formula as shown below

s_group_com_out = "TC=" + s_group_com
  
ptlchg$
  s_group_com_out, e$

 

  • Like 2

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

  • 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