Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: stevehuck on September 19, 2021, 07:37:46 PM

Title: Trying to make Mach4 tool path window like Mach3 and failing.
Post by: stevehuck on September 19, 2021, 07:37:46 PM
I managed to make the background black, the tool path blue, and as the machine or simulation progresses it paints its position white. What I miss is when you click in the window all the previous white is cleared and the white picks up at the current position and continues until the window is clicked again. I assume for that to happen that by clicking the tool path window a "regen tool path" should be triggered to eliminate all the tool path tracking up to that point.

I would like to trigger a Regen Toolpath when clicking the tool path window to see if I get the desired effect. Is that something that needs to happen in Lua? Can this be done?
Title: Re: Trying to make Mach4 tool path window like Mach3 and failing.
Post by: mzc on April 17, 2022, 09:16:13 AM
Hi Steve,
I was trying to refresh the toolpath window from lua code also.

Look up mcToolPathGenerate in the Mach4 Core API docs.
rc = mc.mcToolPathGenerate(number mInst)

While the function seems to do what is advertised, I don't understand the following code's behavior 100%:

   mc.mcCntlSetLastError(inst, "Hello")
   local rc = mc.mcToolPathGenerate(inst)
   mc.mcCntlSetLastError(inst, "World")

The "Hello" is printed in the History/Debug window, but the "World" is never printed.
I'm guessing the GUI state is reset in addition to the toolpath being generated or something. The API doc's don't really help.

Subsequent GUI actions that cause History output write output as expected.

Anyone know why this is so?

Cheers,
Michael.