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:

return single value from pparamter$ string


Recommended Posts

Gentlemen,

 

I have a postabillity post.  Having said that I'm wanting to make a few simple changes myself so I don't have to wait on it becasue i need a few big changes and want this in it before i request the big changes.

 

I've modified the tool list at the beginning to be as simple as possible but give enough info that it could be ran with out setup sheets if need be or at a minimum give my machinists minimum tool setup.

 

I have included tool#, tool description, holder name, projection

 

The only thing i had to add was projection.  To do so i had to create a string, i did so:

sjw_holder      : ""          #JW's Holder string for tool list

i then added it to my tool table line:

scomm_str, *t$, ptspace, " - ", plistcomm,", ", *smholder, ", ", "PROJECTION: ", *sjw_holder, "in, " scomm_end, pe

and gave it value in the pparameter$ block:

if prmcode$ = 20007, sjw_holder = sparameter$, 3

however it returns the entire string like this:

(T124 - 1/4 DRILL, DEFAULT HOLDER, PROJECTION: 0. 2. 2.55 2.5 0.25 2. 1. 0 100. 25. 0 2.55 1.in, )

What am I doing wrong to get only one parameter?

Link to comment
Share on other sites

Just make sure that if you make changes and you need to send it back, that you send back what you have and let them know there are changes....

 

Otherwise you'll receive back the last post they have on file for you

Link to comment
Share on other sites

Just make sure that if you make changes and you need to send it back, that you send back what you have and let them know there are changes....

 

Otherwise you'll receive back the last post they have on file for you

Yeah, I learned that the hard way! The language they want to here is "please sync post".

 

Thanks for the heads up tho!

Link to comment
Share on other sites

To get numeric values from a string parameter, you use either 'rpar' or 'rparsngl' to grab different values, depending on if the string only contains a single value, or if you are grabbing an "array" of values from the string.

 

The '20007' parameter line contains 13 different numeric values, each "space" delimited. You want to grab the "12th" parameter from the string. Try this instead:

 

First, format your variable as a numeric variable, not a string variable:

sjw_holder : 0

By declaring it as a "numeric variable", you can also apply formatting to the variable like so:

fmt  "PROJECTION: "  2 sjw_holder "in, "

You'll notice that I included both a "prefix" and a "suffix" string to the value, and used a "format statement" value of "2", which is up to 4 place decimal (but not forced trailing).

 

By making it a numeric variable, you control the formatting a little differently, using a "fmt" statement.

 

 

Then, modify your code to grab the parameter value. Note: there are two different 'parameter' post blocks. 'pparameter$' is used during normal NC output. 'pwrttparams$' is run during the Tool Table pre-read routine, so if you want the 'stickout' in your Tool List, you should add this to both 'pwrttparams$' and 'pparameter$':

  if prmcode$ = 20007, sjw_holder = rparsngl (sparameter$, 12)

That will grab the 12th parameter from the string, and assign it's value to 'sjw_holder'.

 

Now, just modify the output line a little bit:

scomm_str, *t$, ptspace, " - ", plistcomm,", ", *smholder, ", ", *sjw_holder, scomm_end, pe

Hope that helps,

 

Colin

  • Like 1
Link to comment
Share on other sites
(------------------------------------------------)(  Tool List:                                    )(------------------------------------------------)(T39  - 4IN FINISHER; - HOLDER: DEFAULT HOLDER;  - PROJECTION: 4.)(T47  - 1IN EM; - HOLDER: CAT 50 - EM 1IN, SHORT;  - PROJECTION: 3.1)(T79  - 33MM FLAT GEN2 TA SPADE; - HOLDER: DEFAULT HOLDER;  - PROJECTION: 6.)(T49  - 1.25IN EM; - HOLDER: DEFAULT HOLDER;  - PROJECTION: 6.)(T33  - 2.5IN ISCAR H490; - HOLDER: DEFAULT HOLDER;  - PROJECTION: 2.)(T34  - 1IN .12CR  BULL MILL; - HOLDER: CAT 50 - TG SHORT;  - PROJECTION: 3.9)(T48  - 1IN EM; - HOLDER: CAT 50 - EM 1IN, SHORT;  - PROJECTION: 3.2)(T80  - 20MM ZCARB W/4MM CR; - HOLDER: DEFAULT HOLDER;  - PROJECTION: 5.55)

That's cut and paste from the post, now I gotta finish my tooldb for that machine.

 

Thanks again Colin, if we ever meet the first 6 beers are on me!

Link to comment
Share on other sites
(------------------------------------------------)(  Tool List:                                    )(------------------------------------------------)(T39  4IN FINISHER;  HOLDER=DEFAULT HOLDER;  PROJECTION=4.)(T47  1IN EM;  HOLDER=CAT 50 - EM 1IN, SHORT;  PROJECTION=3.1)(T79  33MM FLAT GEN2 TA SPADE;  HOLDER=DEFAULT HOLDER;  PROJECTION=6.)(T49  1.25IN EM;  HOLDER=DEFAULT HOLDER;  PROJECTION=6.)(T33  2.5IN ISCAR H490;  HOLDER=DEFAULT HOLDER;  PROJECTION=2.)(T34  1IN .12CR  BULL MILL;  HOLDER=CAT 50 - TG SHORT;  PROJECTION=3.9)(T48  1IN EM;  HOLDER=CAT 50 - EM 1IN, SHORT;  PROJECTION=3.2)(T80  20MM ZCARB W/4MM CR;  HOLDER=DEFAULT HOLDER;  PROJECTION=5.55)

did a little more formatting to make it easier to read.

 

Thanks again Colin!

Link to comment
Share on other sites
(------------------------------------------------)(  Tool List:                                    )(------------------------------------------------)(T39  4IN FINISHER;  HOLDER=DEFAULT HOLDER;  PROJECTION=4.)(T47  1IN EM;  HOLDER=CAT 50 - EM 1IN, SHORT;  PROJECTION=3.1)(T79  33MM FLAT GEN2 TA SPADE;  HOLDER=DEFAULT HOLDER;  PROJECTION=6.)(T49  1.25IN EM;  HOLDER=DEFAULT HOLDER;  PROJECTION=6.)(T33  2.5IN ISCAR H490;  HOLDER=DEFAULT HOLDER;  PROJECTION=2.)(T34  1IN .12CR  BULL MILL;  HOLDER=CAT 50 - TG SHORT;  PROJECTION=3.9)(T48  1IN EM;  HOLDER=CAT 50 - EM 1IN, SHORT;  PROJECTION=3.2)(T80  20MM ZCARB W/4MM CR;  HOLDER=DEFAULT HOLDER;  PROJECTION=5.55)

did a little more formatting to make it easier to read.

 

Thanks again Colin!

 

 

Just out of curiosity: What does the projection parameter mean in this case?

Link to comment
Share on other sites
  • 3 months later...

Ok jlw, trying to one up your post.  :smoke:

 

Here is what I have so far.

 

(T1 DIA=0.250 SOL=0.75  1/4 ENDMILL)
(RS=0.750 CL=0.500)

 

But when I call a finisher tool that is the same tool, different number I get this.

 

(T2 DIA=0.250 SOL=0.75  1/4 ENDMILL FINISHER)
(RS=0.750)

 

Where did my cut length go? 

 

------------------------------------------------------------

 

ptooltable      #Tooltable output

      sav_spc = spaces$
      spaces$ = 1
   stoolrs = stoolrs1 + stoolrs2
      sopen_prn, no_spc$, *t$, *tldia$, *stoolsol, pstrtool, no_spc$, sclose_prn, e$
   if stoolcr | stoolcc | stoolrsis,
   [  
   sopen_prn, no_spc$, stoolcr, stoolcc,
  
     if stoolrsis,
  [
     stoolrs
  ]
   stoolcl, no_spc$, sclose_prn, e$   
   ]

 

---------------------------------------------------

 

Also tried this at the end of my ptooltable

 

--------------------------------------------

 

stoolcr = 0
   stoolcc = 0
   stoolrs = 0
   stoolcl = 0
   stoolrsis = 0

 

still no joy.

 

Here is this so you get an idea of the variables.

 

---------------------------------------------------

 

stoolsol     : 0     #Tool SOL
stoolcr      : 0     #Tool radius
stoolcc      : 0     #Tool chamfer
stoolrs      : 0     #Tool relived shank
stoolcl      : 0     #Tool cut length
stoolrs1      : 0     #Tool relived shank math 1
stoolrs2      : 0     #Tool relived shank math 2
stoolrsis      : 0     #Is tool shank relived?

 

... just realized I have relived... not relieved  :clap:

Link to comment
Share on other sites

Ok jlw, trying to one up your post.  :smoke:

 

Here is what I have so far.

 

(T1 DIA=0.250 SOL=0.75  1/4 ENDMILL)

(RS=0.750 CL=0.500)

 

But when I call a finisher tool that is the same tool, different number I get this.

 

(T2 DIA=0.250 SOL=0.75  1/4 ENDMILL FINISHER)

(RS=0.750)

 

Where did my cut length go? 

 

------------------------------------------------------------

 

ptooltable      #Tooltable output

      sav_spc = spaces$

      spaces$ = 1

   stoolrs = stoolrs1 + stoolrs2

      sopen_prn, no_spc$, *t$, *tldia$, *stoolsol, pstrtool, no_spc$, sclose_prn, e$

   if stoolcr | stoolcc | stoolrsis,

   [  

   sopen_prn, no_spc$, stoolcr, stoolcc,

  

     if stoolrsis,

  [

     stoolrs

  ]

   stoolcl, no_spc$, sclose_prn, e$   

   ]

 

---------------------------------------------------

 

Also tried this at the end of my ptooltable

 

--------------------------------------------

 

stoolcr = 0

   stoolcc = 0

   stoolrs = 0

   stoolcl = 0

   stoolrsis = 0

 

still no joy.

 

Here is this so you get an idea of the variables.

 

---------------------------------------------------

 

stoolsol     : 0     #Tool SOL

stoolcr      : 0     #Tool radius

stoolcc      : 0     #Tool chamfer

stoolrs      : 0     #Tool relived shank

stoolcl      : 0     #Tool cut length

stoolrs1      : 0     #Tool relived shank math 1

stoolrs2      : 0     #Tool relived shank math 2

stoolrsis      : 0     #Is tool shank relived?

 

... just realized I have relived... not relieved  :clap:

 

I can't really read the formatting of your code very well. It looks like you might be trying to do an "inline boolean IF" statement.

 

Please use the "Code" tag above when you cut and paste your code in, because it will copy the formatting correctly...

 

Then I'll try and take a look at your code...

Link to comment
Share on other sites

Sorry about that Colin, that if statement you were talking about is very different now but is still an inline statement. I changed the whole post block after finding the tool_type$ variable. But I still have the problem of it posting out the cut length on only the first end mill just as described above.

ptooltable      #Tooltable output
      sav_spc = spaces$
      spaces$ = 1
	  stoolrs = stoolrs1 + stoolrs2
      sopen_prn, no_spc$, *t$, *tldia$, *stoolsol, pstrtool, no_spc$, sclose_prn, e$
	  if tool_typ$ = 10,
	  [	  
	  sopen_prn, no_spc$,	  
	    if stoolrsis,
		[
	        stoolrs
		]
	  stoolcl, stoolcr, stoolcc, no_spc$, sclose_prn, e$ 	  
	  ] 
      spaces$ = sav_spc	 
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...