Page 1 of 1

Add custom tool variables

Posted: Thu Oct 11, 2018 7:28 pm
by David_Lelen01
Is it possible to add custom variables to tool definitions in the tool table? Our waterjet machine has more variables that must be programmed than the default tool variables and I need a way to add these.

Re: Add custom tool variables

Posted: Fri Oct 12, 2018 10:41 am
by Les Newell
Use DefineCustomToolParam:
post.DefineCustomToolParam("WaterTool", "Pump pressure", "pressure", sc.unit0DECPLACE, 40000, 20000, 60000)
This will create a new parameter called 'Pump pressure' in your waterjet tool definitions. It will have a default of 40000, a minimum of 20000 and a maximum of 60000. When that tool is selected you will have a new variable defined in the post processor called 'pressure'.

post.DefineCustomToolParam should be outside of any functions. I generally put it immediately after OnAbout but the exact placement is not important.

Re: Add custom tool variables

Posted: Fri Oct 12, 2018 3:35 pm
by David_Lelen01
That is exactly what i was looking for! Thank you Les!

EDIT:

Actually that is not working. It added the variable to the tool definition, but the post throws an error when it runs on the line where the new variable is.

I put: post.DefineCustomToolParam("WaterTool","ITC: Value Lo","ITCl",sc.unit2DECPLACE,0,0,500) in the post script outside of any function as you mentioned and then later in the code tried to call the variable ITCl by post.NonModalNumber("VA16=", ITCl, "0.##") and it threw an error. I tried to change it exactly you had mentioned before and used pressure for the variable and it still throws the error.

Re: Add custom tool variables

Posted: Sat Feb 02, 2019 9:04 am
by Jolbas
I have the same issue. I can't find any way to access the custom tool parameters anywhere in the post processor code.

Re: Add custom tool variables

Posted: Sun Feb 10, 2019 8:36 pm
by Jolbas
The issue is still there in the 6.1.55 test version. The custom tool parameters appears in the tool dialog but are nil in the post processor as if they never are initiated.

Re: Add custom tool variables

Posted: Mon Feb 11, 2019 12:26 pm
by Les Newell
Try restarting SheetCam. Sometimes the variables don't appear until after you have restarted.

Re: Add custom tool variables

Posted: Mon Feb 11, 2019 6:21 pm
by Jolbas
Yes!
After a lot of restarts renaming and resetting the values in the tool dialog it finally gave up and passed the parameters to the post processor. Not really sure what made it work.

Re: Add custom tool variables

Posted: Fri Jul 26, 2019 7:39 pm
by David_Lelen01
I finally had a chance to revisit this project and i am still unable to get the post processor to read the added variables. I have tried saving the default tool set a hundred times and closing and restarting the program, it just will not work. Attached are screenshots of what is happening. Hopefully you have an idea.

Re: Add custom tool variables

Posted: Fri Jul 26, 2019 9:10 pm
by Jolbas
I don’t think you can see it until the OnToolChange() function is called. The tool is not set in OnInit()

Re: Add custom tool variables

Posted: Mon Jul 29, 2019 11:12 am
by David_Lelen01
I would think it should still be available to be called at any time though once the post is loaded. Perhaps not.

So that leads to the question, When is the tool set in sheetCAM? How could I make sure all the code i had in OnInit() is before any other code? Create another function and call it from OnInit()?

UPDATE: You were absolutely right! I moved all the code i was trying to write and simply put it under the function OnToolChange(). This shouldn't ever cause a problem because i wont be changing tools in the middle of a cut on the WaterJet anyways.

Re: Add custom tool variables

Posted: Tue Jul 30, 2019 1:19 pm
by Les Newell
The tool parameters are only available once the tool has been selected. They aren't available in OnInit() because at that point the post doesn't know what tools will be needed.

Re: Add custom tool variables

Posted: Tue Jul 30, 2019 2:09 pm
by David_Lelen01
That actually makes sense, forgive me i was having a blonde moment haha

Re: Add custom tool variables

Posted: Thu Oct 01, 2020 12:03 pm
by Sam Plasma Cut
Les Newell wrote: Fri Oct 12, 2018 10:41 am Use DefineCustomToolParam:
post.DefineCustomToolParam("WaterTool", "Pump pressure", "pressure", sc.unit0DECPLACE, 40000, 20000, 60000)
This will create a new parameter called 'Pump pressure' in your waterjet tool definitions. It will have a default of 40000, a minimum of 20000 and a maximum of 60000. When that tool is selected you will have a new variable defined in the post processor called 'pressure'.

post.DefineCustomToolParam should be outside of any functions. I generally put it immediately after OnAbout but the exact placement is not important.
I am working on a a project the needs custom tool paramitors and I beleive this code would be usefull however I cant seem to find were you inted for this code to be input.

thanks Sam

Re: Add custom tool variables

Posted: Thu Oct 01, 2020 12:32 pm
by Les Newell
It goes in your post processor, outside of any function.