Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: softselect on December 29, 2009, 05:00:42 PM

Title: VB commands needed for tooltable
Post by: softselect on December 29, 2009, 05:00:42 PM
I have just completed my all in one lathe screen, now i want to add a wear offset calculation routine, that will read the current tool wear value and a userDRO contaning the wearoffset measured, then do some math and store the recalculated wear value back in the tool table

the code i will use to get the measured wear is something like this, but i cant fint the correct commands/veriable names

TWx=GetUserDRO(1201)     (read value from user DRO 201)
TW=GetWear....? (get wear value of X or Z from tooltable)
calculate new value for X axis e.g. (TWx/2)*-1 + TW
setWear.... = newvalue (store new value to tooltable)

Hope someone can help
Friedrich

Title: Re: VB commands needed for tooltable
Post by: Chaoticone on December 29, 2009, 05:43:01 PM
Friedrich, see if the attached helps. It is only for a refrence for you. Still lots of checking, verifying, editing to do. Maybe an idea of some things to come. Use the numbers in the old numbers column.

Brett
Title: Re: VB commands needed for tooltable
Post by: softselect on December 30, 2009, 07:45:53 AM
Thanks Brett,
But i dont see a code for the tool wearx and wearz
I will post the Q on yahoo, maye Brain or Art can help
Friedrich
Title: Re: VB commands needed for tooltable
Post by: Graham Waterworth on December 30, 2009, 11:59:55 AM
GetToolParam(SHORT toolnum, SHORT param) for tool parameters.

Param numbers are 1 - n and correspond to the tool window in the mill or turn modes. In turn for example, 1 is TipDia, 2 is Tip Radius. Etc.

And to put it back use :-

SetToolParam(SHORT toolnum, SHORT param, DOUBLE data)

Then you must re-store the tool table by doing a DoButton(316) "save tool table"

This is all from memory as I am not at my normal computer, errors may be included free of charge  ;D

Graham
Title: Re: VB commands needed for tooltable
Post by: softselect on December 30, 2009, 02:29:20 PM
hi Graham
thanks for the info, i tried the following code
CT=GETDRO(24)
DTX=GETTOOLCT (SHORTCT, SHORT5)
TWx=GetUserDRO(1201)
NV=((TWX/2)*-1)+DTX
SetToolCT(SHORTCT, SHORT 5, DOUBLE NV)
DoButton(316)

and i get an error "Scriptter compile error"

Break down of what i am trying to do
CT=GETDRO(24)                                        /get current tool number
DTX=GETTOOLCT (SHORTCT, SHORT5)            /get wear value from table, if i add line y line for testing it give error here already
TWx=GetUserDRO(1201)                             /get user wear value
NV=((TWX/2)*-1)+DTX                               /calculate new waer value
SetToolCT(SHORTCT, SHORT 5, DOUBLE NV) /store new wear value
DoButton(316)                                           /save tool table


i am probebly doing it all wrong, but then the last real programming i done was BBC basic back in the 80's
thanks Friedrich
Title: Re: VB commands needed for tooltable
Post by: Graham Waterworth on December 30, 2009, 03:21:06 PM
Try it more like this :-

CT=GETDRO(24)
DTX=GETTOOLparam(CT ,5)
TWx=GetUserDRO(1201)
NV=((TWX/2)*-1)+DTX
SetToolparam(CT, 5, NV)
DoButton(316)

Graham
Title: Re: VB commands needed for tooltable
Post by: softselect on December 31, 2009, 05:35:04 AM
hi Graham
Thanks for the prompt responce, i tried it like you said, now i dont get the error, but nothing happens, any ideas
i saw some code on the forum some where that said to use CALL in front of the GetDRO...., tried that but it seems to have no effect
the tool table doesnt even come up, i even changed it to doButton(121)
maybe i should just wait till you get to ur usual computer, i assume its at your shop
Thanks for your time
Friedrich
Title: Re: VB commands needed for tooltable
Post by: softselect on January 02, 2010, 05:25:36 PM
hi graham,
the solution is as follows, thanks for your guidance, once i put in the dim statements it worked

DIM CT
DIM DTX
DIM TWX
DIM NV
'X WEAR=5
'ZWEAR=6
CT=GETDRO(24)         'GET CURRENT TOOL
DTX=GetToolParam(CT,5)      'GET CURRENT WEAR OFFSET
TWx=GetUserDRO(1201)         'GET REQUESTED OFFSET
NV=((TWX/2)*-1)+DTX         'CALCULATE ACCUMULATED OFFSET
CALL SetToolparam(CT, 5, NV)      'SEND VALUE TO TOOL TABLE
MESSAGE "OFFSET ACCUMULATED"   'STATUS INDICATOR
DoOEMBUTTON(121)         'SAVE TOOLTABLE

Happy new year from a swelteringly hot South Africa

Thanks Friedrich