I’m using the standard Mach3 post processor and now have a semi-auto tool change routine built into Mach3.
I need to remove the tool change command for the FIRST tool in a job as this is carried out before the code is loaded.
Subsequent changes are fine.
i.e. the Post needs to assume the correct tool is loaded and set before the code runs.
Any ideas where i can alter the post for this???
Thanks
I’ve tried editing the post as i have done on my plasma but as soon as i touch it i get loads of errors?
I place this at the start…
post.DefineVariable (“FirstTool”,-1)
My idea was to wrap the Toolchange event code in a If-Then block that says if FirstTool then do nothing but set first tool to false so next time round it runs ok.
But as soon as i place the define statement in, I get compile errors?
Can this post be edited?
Or have i missed a trick?
I think I have it, trial and error:)
post.DefineVariable (xxxx Needed to be in the OnInit() function
Then I just used a If-Then block to only allow the OnToolChange code to run if it has been skipped once already.
One anomaly is that the code generated has the spindle speed in it twice but that will not harm anything.
Don’t use DefineVariable. This is used to expose post processor variables to SheetCam. Any variable defined this way will appear in the ‘Set post processor variable’ operation.
Lua creates variables automatically the first time you use them. Here is how I would do it:
In function OnInit
FirstTool = true --this automatically creates the global variable ‘FirstTool’
In OnToolChange
If FirstTool then
FirstTool = false
return
end
You get the extra S command because a tool change resets all modal g-codes.
Thanks Les, changes made, all working nicely 