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:

String Selector SCOMP_TYPE


CarbonCAD
 Share

Recommended Posts

I never have delved deeply with the String Selector Tables, but now I what seems to be an easy change, but I cannot get it to post correctly. I am trying to insert a comment into the program that states what kind of comp is on. I am only getting computer comp to output despite what is set in the operation. Computer comp is initialized as 0, so I wonder if it is not updating. I really don't know. Any suggestions?

 

# Cutter Compensation Type

scomp : "COMPUTER COMP"

scomp1 : "CONTROL COMP"

scomp2 : "WEAR COMP"

scomp3 : "REVERSE WEAR COMP"

scomp4 : "OFF"

scomp_type : "" #Target string

 

fstrsel scomp comp_type scomp_type 5 -1

 

ptlchg0$ #Call from NCI null tool change (tool number repeats)

pcuttype

 

pcom_moveb

pcheckaxis

c_mmlt$ #Multiple tool subprogram call

comment$

pcan

result = newfs(15, feed) #Reset the output format for 'feed'

pbld, n$, sgplane, e$

pspindchng

pbld, n$, scoolant, e$

if mi1$ > one & workofs$ <> prv_workofs$,

[

sav_absinc = absinc$

absinc$ = zero

pbld, n$, sgabsinc, pwcs, pfxout, pfyout, pfzout, pfcout, e$

pe_inc_calc

ps_inc_calc

absinc$ = sav_absinc

]

if cuttype = zero, ppos_cax_lin

#Disable SGI Mode if previously on and not on now or mode has changed

if prv_mi4$ & (mi4$ = zero | prv_mi4$ <> mi4$), psgi_off

#Enable SGI mode if not previously on and on now or mode has changed

if mi4$ & (prv_mi4$ = zero | prv_mi4$ <> mi4$), psgi_on

if gcode$ = one, plinout

else, prapidout

"(", *scomp_type, ")", e$ # added line 10-17-12 JP

pcom_movea

toolchng0 = zero

c_msng$ #Single tool subprogram call

!xnci$, !ynci$, !znci$, !mi4$

Link to comment
Share on other sites

Sounds like you need to buffer it to recall it. Once it is called in the tooltable it is disposed of for your use later. You would need to buffer it out to then be recalled when you want it here. Just throwing darts at the dart board here, but always seen it called in a tooltable or some other place where it is not used again once called.

Link to comment
Share on other sites

The string select table you are using is used in 'pwrtt$' to output compensation type. The selector variable is set with a parameter read function. The problem is that the selector variable only gets set during tool table output, because the parameter read function is only setup in 'pwrttparams$'.

 

The solution is pretty straightforward: you need to copy the logic from 'pwrtrparams$' into the 'pparameter$' post block. (just the single parameter read line that sets the selector)

 

Link to comment
Share on other sites

I can't find pwrttparam$, but this is what the rest of what I have to work with looks like. Straightforward never seems be straightforward for me :)

 

ptooltable #Tooltable output

sopen_prn, *t$, sdelimiter, pstrtool, sdelimiter, *tlngno$,

[if comp_type > 0 & comp_type < 4, sdelimiter, *tloffno$, sdelimiter, *scomp_type, sdelimiter, *tldia$],

[if xy_stock <> 0 | z_stock <> 0, sdelimiter, *xy_stock, sdelimiter, *z_stock],

sclose_prn, e$

xy_stock = 0 #Reset stock to leave values

z_stock = 0 #Reset stock to leave values

 

pwrtt$ #Pre-read NCI file

if tool_info > 1 & t$ > 0 & gcode$ <> 1003, ptooltable

 

 

pparameter$ #Read operation parameters

#rd_params is used to call pparameter postblock and read the parameters of the operation specified in rd_param_op_no

#"pparameter", ~prmcode$, ~sparameter$, e$

if prmcode$ = 12025, rotary_axis2 = rpar(sparameter$, 1) #Capture the axis of rotation in Multiaxis Drill and Curve 5 Axis

Link to comment
Share on other sites

Colin if the logic is already there why would you need to call it again? Don't you need to parse it outside of the pwrtt to be called later? It was always my understanding the NCI stored it and the .pst calls it. Some items are stored once in the NCI and some are called or placed as needed in the NCI. So with that all the tool information being placed in the NCI and then buffered as used to place it in the memory so they can be called at will like you want through out the posted code using the buffers to store then call it. In this case since it is not a normal placement you have 2 options make the tool change call in the pwrtt do what you want or buffer it out. Again just throwing darts here hoping to help someone get the job done. The best course of action is to always contact your dealer for support, but hard headed people like myself always tried to figure out their problems verse asking the dealer for help. :guitar:

Link to comment
Share on other sites

I can't find pwrttparam$, but this is what the rest of what I have to work with looks like. Straightforward never seems be straightforward for me :)

 

ptooltable #Tooltable output

sopen_prn, *t$, sdelimiter, pstrtool, sdelimiter, *tlngno$,

[if comp_type > 0 & comp_type < 4, sdelimiter, *tloffno$, sdelimiter, *scomp_type, sdelimiter, *tldia$],

[if xy_stock <> 0 | z_stock <> 0, sdelimiter, *xy_stock, sdelimiter, *z_stock],

sclose_prn, e$

xy_stock = 0 #Reset stock to leave values

z_stock = 0 #Reset stock to leave values

 

pwrtt$ #Pre-read NCI file

if tool_info > 1 & t$ > 0 & gcode$ <> 1003, ptooltable

 

 

pparameter$ #Read operation parameters

#rd_params is used to call pparameter postblock and read the parameters of the operation specified in rd_param_op_no

#"pparameter", ~prmcode$, ~sparameter$, e$

if prmcode$ = 12025, rotary_axis2 = rpar(sparameter$, 1) #Capture the axis of rotation in Multiaxis Drill and Curve 5 Axis

 

 

 

Here is a snippet of code from the Generic Fanuc 4X Mill Post:

 

pwrttparam$	 #Pre-read parameter data
  #"pwrttparam", ~prmcode$, ~sparameter$, e$
  if prmcode$ = 15346, comp_type = rpar(sparameter$, 1) #Cutter compensation type - 0=computer, 1=control, 2=wear, 3=reverse wear, 4=off
  if prmcode$ = 10010, xy_stock = rpar(sparameter$, 1)  #Capture stock to leave (XY)
  if prmcode$ = 10068, z_stock = rpar(sparameter$, 1)   #Capture stock to leave (Z)
pparameter$	 #Read operation parameters
  #rd_params is used to call pparameter postblock and read the parameters of the operation specified in rd_param_op_no
  #"pparameter", ~prmcode$, ~sparameter$, e$
  if prmcode$ = 12025, rotary_axis2 = rpar(sparameter$, 1) #Capture the axis of rotation in Multiaxis Drill and Curve 5 Axis
 # Check To See if tool is metric
 if prmcode$ = 20007, toolismetric = rparsngl(sparameter$, 11)  
  if prmcode$ = 15346, comp_type = rpar(sparameter$, 1) #Cutter compensation type - 0=computer, 1=control, 2=wear, 3=reverse wear, 4=off

 

If 'pwrttparams$' is not present in your post, you can add it.

 

Note that 'pwrttparams$' is only used for reading parameters during the Tool Table output. 'pparameter$' is automatically read during a Tool Change event (so adding the code to read '15346' will make the 'comp_type' variable available during a Tool Change in the Post).

Link to comment
Share on other sites

Colin if the logic is already there why would you need to call it again? Don't you need to parse it outside of the pwrtt to be called later?

 

 

 

 

It was always my understanding the NCI stored it and the .pst calls it. Some items are stored once in the NCI and some are called or placed as needed in the NCI.

 

So with that all the tool information being placed in the NCI and then buffered as used to place it in the memory so they can be called at will like you want through out the posted code using the buffers to store then call it.

 

 

In this case since it is not a normal placement you have 2 options make the tool change call in the pwrtt do what you want or buffer it out. Again just throwing darts here hoping to help someone get the job done. The best course of action is to always contact your dealer for support, but hard headed people like myself always tried to figure out their problems verse asking the dealer for help. :guitar:

 

Hi Ron,

 

There are a couple things going on with 'pwrtt$', so I'll try and shed some light on what is going on.

 

"Colin if the logic is already there why would you need to call it again? Don't you need to parse it outside of the pwrtt to be called later?"

 

There is a difference between NCI values and Parameter values. NCI codes are written to the NCI file and include Toolpath motion commands, Tool information, and some Setup/Machine information. The NCI file does not contain all the data that is available to the Post. Other data (MD/CD/Operation/Machine group properties) is written to an internal memory map, and is available to the post writer by adding Parameter read logic to either 'pwrttparams$' or to 'pparameter$'.

 

Some data is stored in both pre-defined variables and is also written to the memory map as a parameter. There is a lot of data though that is only available with a Parameter read function.

 

'pwrttparams$' is used to read the parameters during the NCI Pre-Read process, so you can extract the parameter data and use it in the Tool Table output from 'pwrtt$'. The data you are reading is loaded into a user-defined variable. You could load the data into a buffer file during the processing of 'pwrtt$', but it isn't really necessary depending on what you are trying to accomplish.

 

 

'pparameter$' is called automatically at Tool Change events in the Post. This post block is used to read the parameters during normal processing (normal NCI read loop, writing to the NC file).

 

Note that the NCI file is never modified by the PST file. It is always read 'as-is' and the data presented in the NCI can be augmented by adding parameter read logic. The combination of NCI data and Parameter data allows you to access almost any conceivable piece of data from your Mastercam toolpaths.

 

"In this case since it is not a normal placement you have 2 options make the tool change call in the pwrtt do what you want or buffer it out"

 

As mentioned, you can certainly read/write to a buffer file in 'pwrtt$' if you want to. In our generic posts, we do not use a user-defined buffer. Instead, we normally take advantage of the internal buffer used by MP to process the Tool Table.

 

If you look in our generic post at the 'pwrtt$' logic, you will see this line:

 

  if tool_info > 1 & t$ > 0 & gcode$ <> 1003, ptooltable

 

The second condition of the 'if' statement is 't$ > 0'. This checks to be sure the Tool Number is signed positive. The reason for this is the way MP handles Tool Changes during the 'pwrtt$' loop. When 'pwrtt$' is called, MP will process the entire NCI file and look for Tool Change and Null Tool Change events. On the first occurrence of each tool, the tool number 't$' is signed positive, so it is written to the Tool Table buffer (MP internal buffer). On all future occurrences of each tool, the tool number is signed negative (but only during the 'pwrtt$' pre-read loop). This makes sure you don't get duplicate entries in the tool table.

 

 

Hope that helps,

 

Colin

  • Like 1
Link to comment
Share on other sites

Excellent info. I also referenced the documentation I received from our retailer and I still can't get it. I think my problem comes in where the tool# is set to a -1 in the toolchange , but If I remove the t$ > 0 then it posts many t-1's. Here is what I have. Looks like it should be simple. Anyone have comments?

 

pcomptable

" ", sopen_prn, op_num, sdelimiter, *t$, sdelimiter, *scomp_type, sclose_prn, e$

 

pwrttparam$ #Pre-read parameter data (read param. during pre-read to extract data to use in pwrtt$

#"pwrttparam", ~prmcode$, ~sparameter$, e$

if prmcode$ = 15346, comp_type = rpar(sparameter$, 1) #Cutter compensation type - 0=computer, 1=control, 2=wear, 3=reverse wear, 4=off

if prmcode$ = 15240, op_num = rpar(sparameter$, 1) #Operation number as shown in Mastercam file

 

pwrtt$ #Pre-read NCI file

#if tool_info > 1 & t$ > 0 & gcode$ <> 1003, ptooltable

if op_num > 0 & gcode$ <> 1003 & t$ > 0, pcomptable

 

Output:

( op_num 1. | T1 | COMP OFF )

( op_num 3. | T2 | COMP OFF )

 

Should also have ( op_num 2. | T1 | COMP WEAR )

Link to comment
Share on other sites

CarbonCAD,

 

I created a test file, using the Generic Fanuc 4X Mill Post as a sample. I created 5 contour operations, each with a different tool number, and each set to a different compensation type.

 

Then I modified the 'ptooltable' post block to output the Tool number, the delimiter, and the comp type. Here is the output below:

 

(NC FILE - C:\USERS\CMG\DOCUMENTS\MY MCAMX6\MILL\NC\T.NC)
(MATERIAL - ALUMINUM INCH - 2024)
( T239 | COMPUTER )
( T246 | CONTROL COMP )
( T253 | WEAR COMP )
( T258 | REVERSE WEAR COMP )
( T260 | OFF )
N100 G20
N102 G0 G17 G40 G49 G80 G90
( 4 - AXIS VMC )
( Machine Group-1 )
N104 T239 M6

 

Here is the 'ptooltable' post block:

ptooltable	  #Tooltable output
  sopen_prn, *t$, sdelimiter, *scomp_type,
    sclose_prn, e$
  xy_stock = 0  #Reset stock to leave values
  z_stock = 0   #Reset stock to leave values

 

Here is 'pwrtt$' and 'pwrttparam$':

pwrtt$		  #Pre-read NCI file
  if tool_info > 1 & t$ > 0 & gcode$ <> 1003, ptooltable
pwrttparam$	 #Pre-read parameter data
  #"pwrttparam", ~prmcode$, ~sparameter$, e$
  if prmcode$ = 15346, comp_type = rpar(sparameter$, 1) #Cutter compensation type - 0=computer, 1=control, 2=wear, 3=reverse wear, 4=off
  if prmcode$ = 10010, xy_stock = rpar(sparameter$, 1)  #Capture stock to leave (XY)
  if prmcode$ = 10068, z_stock = rpar(sparameter$, 1)   #Capture stock to leave (Z)

Link to comment
Share on other sites

It's a lot more cleaned up now. I am still having the problem of one tool being used for two different operations, but with different comps on each of the operations.

 

(T1 | COMP OFF ) This would be the first operation.

<---- (T1 | CONTROL COMP ) This would be the second operation with different comp. It would have the same tool as operation one, but is not posted.

(T2 | COMPUTER COMP) This would be the third operation with a different tool

 

What I see in my mind is that the t$ > 0 will have to be replaced with some other logic (due to the fact that if the tool has been used before it is assigned a -1) to have the tool post again, but somehow with the new comp.

Link to comment
Share on other sites

If I remove the t$ > 0 why does it give me this many?

( T1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | COMP OFF )

( T-1 | CONTROL COMP )

| D1 | CONTROL COMP | TOOL DIA. - .1875

( T-1 | CONTROL COMP )

| D1 | CONTROL COMP | TOOL DIA. - .1875

( T2 | COMPUTER COMP )

Link to comment
Share on other sites

Do you really want multiple entries in the Tool Table for this? No big deal if you do, but you are correct about needing to figure out the logic. Personally, I'd leave the compensation type out of the Tool Table, but output it for each Tool Comment in 'ptlchg$' and 'ptlchg0$'.

 

The main problem I see with this is that there is no easy way to see if the tool has been output previously with a different compensation value. You could write some logic that would check the previous value of 'comp_type', but that would only check the last comp_type value.

 

At this point, your solution would probably involve creating two buffer files. You could write all the tool information to the first buffer, then create another buffer to sort and filter the data before output. This would not be a trivial task.

Link to comment
Share on other sites

The reason you are getting so many entries when 't$' is negative one, is due to the Null Toolchange events.

 

A Null Toolchange (gcode$ = 100) is written for each depth cut or multipass in an operation.

 

So a Contour Operation that has depth cuts enabled will have multiple null tool change events, even though it is a single operation.

 

Using the "default" processing for 'pwrtt$' may not give you what you are after. You will probably need to use a couple buffer files to accomplish this...

Link to comment
Share on other sites

Nice description - "trivial task" :)

 

I see variables in the MP Processing.pdf: nextdc$, nextop$, nextccomp$, nextcflg$. Would any of these be of any help?

 

Thanks for the help. Sounds like I may have to find another route.

 

For information purposes what is going on is we have a new Makino machine and it likes all line segments and not G2 or G3's, but that causes very large files. It holds them fine, but it is limited in the size of file that can be edited at the machine. The guys would like to see it up front. We had some problems and this was suggested to lessen possible future issues.

Link to comment
Share on other sites

Colin thanks for that explaintion been extremly busy and sick so just getting to the forum today from last week. I hope I was not implying the MP modified the NCI. I was only trying to point out the MP can only use what the NCI gives it and if someone were looking to NCI for information they could conculde that certain information only come up once in the NCI. Not knowing how the MP stores and buffers data then someone trying to develope something like what is going in in this thread could logically come to the conclusion they need to buffer. Since you filled in some of the blanks about magically working stuff going on with MP and NCI now someone can do more with that information. Here is some of my added defined stuff to an In-House post so others can see how extreme you can get with posted code for information going out to the operators.

 

plstock  # Comment amount of stock to leave (Lathe)
	 spaces$ = 0
	 stoper = ucase(stoper)
	 if posttype$ = 2,
	   [
		 if tool_op$ = 60,
		 [
		 n$, pspc, scomm_str, "TOOLPATH - ", *stoper, scomm_end, e$
		 n$, pspc, scomm_str, "DEPTH OF CUT = ", *lrdepth, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lrstockx, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lrstockz, scomm_end, e$
		 ]
		 if tool_op$ = 61,
		 [
		 n$, pspc, scomm_str, "TOOLPATH - ", *stoper, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lfstockx, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lfstockz, scomm_end, e$
		 ]
		 if tool_op$ = 62,
		 [
		 n$, pspc, scomm_str, "TOOLPATH - ", *stoper, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER ROUGH = ", *lgrstockx, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON FACES ROUGH = ", *lgrstockz, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER FINISH = ", *lgfstockx, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON FACES FINISH = ", *lgfstockz, scomm_end, e$
		 n$, pspc, scomm_str, "WIDTH OF GROOVE = ", *lgwidth, scomm_end, e$
		 ]
		 if tool_op$ = 63,
		 [
		 n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lfstockz, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lfstockz, scomm_end, e$
		 ]
		 if tool_op$ = 66,
		 [
		 n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lfstockz, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lfstockz, scomm_end, e$
		 ]
		 if tool_op$ = 68,
		 [
		 n$, pspc, scomm_str, "TOOLPATH - ", *stoper, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER ROUGH = ", *lgrstockx, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON FACES ROUGH = ", *lgrstockz, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER FINISH = ", *lgfstockx, scomm_end, e$
		 n$, pspc, scomm_str, "STOCK LEFT ON FACES FINISH = ", *lgfstockz, scomm_end, e$
		 n$, pspc, scomm_str, "WIDTH OF GROOVE = ", *lgwidth, scomm_end, e$
		 ]
		 if tool_op$ = 201,
		 [
		 #n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lfstockz, scomm_end, e$
		 #n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lfstockz, scomm_end, e$
		 ]
		 if tool_op$ = 202,
		 [
		 #n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lfstockz, scomm_end, e$
		 #n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lfstockz, scomm_end, e$
		 ]
		 if tool_op$ = 203,
		 [
		 #n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lstockz, scomm_end, e$
		 #n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lstockz, scomm_end, e$
		 ]
		 if tool_op$ = 204,
		 [
		 #n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lstockz, scomm_end, e$
		 #n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lstockz, scomm_end, e$
		 ]
		 if tool_op$ = 205,
		 [
		 #n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lstockz, scomm_end, e$
		 #n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lstockz, scomm_end, e$
		 ]
		 if tool_op$ = 208,
		 [
		 #n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lstockz, scomm_end, e$
		 #n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lstockz, scomm_end, e$
		 ]
		 if tool_op$ = 209,
		 [
		 #n$, pspc, scomm_str, "STOCK LEFT ON DIAMETER = ", *lstockz, scomm_end, e$
		 #n$, pspc, scomm_str, "STOCK LEFT ON FACES = ", *lstockz, scomm_end, e$
		 ]
	  ]

pparameter$	 #Information from parameters
	 #"pparameter", ~prmcode$, ~sparameter$, e$ #Brute Force Method for finding Vaules
	 if opcode$=13 | opcode$=14, result = fprm (opcode$)
	 if prmcode$ = 10000, stoper = sparameter$
	 if stoper=snull, stoper = snullop
	 if prmcode$ = 15552, toolangle = rpar(sparameter$,1)
	 if prmcode$ = 10005, tdia = rpar(sparameter$,1)		 # Tool Dia Milling
	 if prmcode$ = 10006, tradius = rpar(sparameter$,1)	 # Tool Corner Radius Milling
	 if prmcode$ = 10010, stock = rpar(sparameter$,1)	 # Stock to leave in Z Milling
	 if prmcode$ = 10068, stock1 = rpar(sparameter$,1)	 # Stock to leave in XY Milling
	 if prmcode$ = 10102, lfstockx = rpar(sparameter$,1)	 # Amount of Stock Left X Turning Finishing
	 if prmcode$ = 10103, lfstockz = rpar(sparameter$,1)	 # Amount of Stock Left Z Turning Finishing
	 if prmcode$ = 10202, lrstockx = rpar(sparameter$,1)	 # Amount of Stock Left X Turning Roughing
	 if prmcode$ = 10203, lrstockz = rpar(sparameter$,1)	 # Amount of Stock Left Z Turning Roughing
	 if prmcode$ = 13343, lrdepth = rpar(sparameter$,1)	 # Depth of Cut Lathe Roughing
	 if prmcode$ = 10214, lathdir = rpar(sparameter$,1)	 # Direction 0=ID,1=OD,2=FACE,3=BACK Turning
	 if prmcode$ = 12068, stock2 = rpar(sparameter$,1)	 # Stock to leave in Z facing Milling
	 if prmcode$ = 10020, clearinc = rpar(sparameter$,1)	 #param 10020 is clearance now and 10021 indicates abs or inc
	 if prmcode$ = 13359, lgrstockx = rpar(sparameter$,1) # Amount of Stock Left X Turning Groove Roughing
	 if prmcode$ = 13360, lgrstockz = rpar(sparameter$,1) # Amount of Stock Left Z Turning Groove Roughing
	 if prmcode$ = 10366, lgfstockx = rpar(sparameter$,1) # Amount of Stock Left X Turning Groove Finishing
	 if prmcode$ = 10367, lgfstockz = rpar(sparameter$,1) # Amount of Stock Left Z Turning Groove Finsihing
	 if prmcode$ = 10331, lgwidth = rpar(sparameter$,1)	 # Width of Groove		
	 if prmcode$ = 15100, clearflg = rpar(sparameter$,1)
	 if prmcode$ = 15145, metvals = rpar(sparameter$,1)
	 if prmcode$ = 15147, lturret = rpar(sparameter$,1)	 # Turret Being Used
	 if prmcode$ = 15148, lspindle = rpar(sparameter$,1)	 # Spindle Being Used
	 if prmcode$ = 15339, clearstrt = rpar(sparameter$,1)
	 if prmcode$ = 15346, comp_type = rpar(sparameter$,1) #Cutter Compensaation Type (Lathe)
	 if prmcode$ = 15347, comp_dir = rpar(sparameter$,1)	 #Cutter Comp Direction (Lathe and Mill)
	 if prmcode$ = 15182, miscvalon = rpar(sparameter$,1)
	 if prmcode$ = 20010, sconstplname = ucase(sparameter$)
	 if prmcode$ = 20011, sconstplcomm = ucase(sparameter$)
	 if prmcode$ = 20012, stoolplname = ucase(sparameter$)
	 if prmcode$ = 20013, stoolplcomm = ucase(sparameter$)
	 if prmcode$ = 20014, swcsplname = ucase(sparameter$)
	 if prmcode$ = 20015, swcsplcomm = ucase(sparameter$)
	 if prmcode$ = 20016, smatlname1 = ucase(sparameter$)
	 if prmcode$ = 20017, smatlname2 = ucase(sparameter$)
	 if prmcode$ = 20018, stpgrpname = ucase(sparameter$)
	 if prmcode$ = 20103, stinsert2 = sparameter$
	 if prmcode$ = 20110, stholder2 = sparameter$
	 #if prmcode$ = 20100, ltooltype = sparameter$
	 if prmcode$ = 12025, rotary_axis2 = rpar(sparameter$,1) #Capture the axis of rotation in Multiaxis Drill and Curve 5 Axis
	 if prmcode$ = 15371, axissubdir = rpar(sparameter$,1)
	 if prmcode$ = 12628,
		 [
		 hst_flg = 1
		 hststyle = rpar(sparameter$,1)
		 ]
	 if prmcode$ = 20111, shape = rpar(sparameter$,15)
	 if prmcode$ = 20008, head_x = rpar(sparameter$,9)

 

HTH

Link to comment
Share on other sites

CarbonCAD,

 

Getting your tool list to work might be easier than I thought. I did some playing around with 'op_id$', and found that the previous value does not get updated during the 'pwrtt$' loop. So I added some logic to capture the value of 'op_id$' in a user-defined variable, and made sure to update that variable at the end of the 'ptooltable' post block.

 

Now you will get an entry in the Tool Table for every operation, along with that operation's compensation type. This may be an issue if you are posting dozens (or hundreds) of operations, as your Tool Table can grow pretty quickly. I think it will get you the information that you desire, without having to build your own buffers/logic.

 

First, initialize a user-defined variable:

op_flg   : 0

 

Next, set the 'op_flg' value in 'pwrtt$' from the 'op_id$' variable, and add some logic to check the current vs. previous value:

pwrtt$		  #Pre-read NCI file
  op_flg = op_id$
  if tool_info > 1 & op_flg <> prv_op_flg & gcode$ <> 1003, ptooltable

 

Last, make sure you update the value of 'op_flg' at the end of the 'ptooltable' post block:

ptooltable	  #Tooltable output
  sopen_prn, *t$, sdelimiter, *scomp_type
    sclose_prn, e$
  xy_stock = 0  #Reset stock to leave values
  z_stock = 0   #Reset stock to leave values
  !op_flg	   #Update op_flg for logic test in pwrtt

 

Here is the Tool Table output. I have the same tool number set for all 5 operations, and each operation has multi-passes and depth cuts enabled:

 

( T239 | COMPUTER )
( T-239 | CONTROL COMP )
( T-239 | WEAR COMP )
( T-239 | REVERSE WEAR COMP )
( T-239 | OFF )

 

 

Something you might notice is the 'dash' between the T and the Tool Number. This is actually a minus sign, as the tool number is repeating, so it is signed negative. You could add the 'abs()' function in a separate line (above the output line) in 'ptooltable' to use the absolute value of 't$' instead.

 

ptooltable	  #Tooltable output
  t$ = abs(t$)
  sopen_prn, *t$, sdelimiter, *scomp_type
    sclose_prn, e$
  xy_stock = 0  #Reset stock to leave values
  z_stock = 0   #Reset stock to leave values
  !op_flg	   #Update op_flg for logic test in pwrtt

 

Hope that helps...

Link to comment
Share on other sites

One more thing, since you are getting multiple lines for the same tool number, I would recommend adding a 'fmt' format assignment line for 'op_flg', and add that parameter to the Tool Table output line. That way you would get something like this:

 

( OP# 1 - T239 | COMPUTER )
( OP# 2 - T239 | CONTROL COMP )
( OP# 3 - T239 | WEAR COMP )
( OP# 4 - T239 | REVERSE WEAR COMP )
( OP# 5 - T239 | OFF )

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