Add custom tool variables

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.

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.

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.

I have the same issue. I can’t find any way to access the custom tool parameters anywhere in the post processor code.

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.

Try restarting SheetCam. Sometimes the variables don’t appear until after you have restarted.

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.

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.


I don’t think you can see it until the OnToolChange() function is called. The tool is not set in OnInit()

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.

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.

That actually makes sense, forgive me i was having a blonde moment haha

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

It goes in your post processor, outside of any function.