Hello Guest it is January 17, 2022, 05:03:06 PM

Author Topic: Toolpath Display with 4 Axis  (Read 1323 times)

0 Members and 1 Guest are viewing this topic.

Offline Mauri

*
  •  327 327
    • View Profile
Toolpath Display with 4 Axis
« on: June 27, 2019, 07:06:41 PM »
Hi,
I have complained about this for more that 3 years now.
If you are doing complex 4 Axis G-Code, I have made the following extensive tests on 4 PC's and my findings are below.
1) Mach4 with Sim plugin ticked, Toolpath display bears no resemblance to the actual G-Code.
2) Mach4 with HiCON plugin, Toolpath display is correct, but requires HiCON to be connected to run simulation.
3) Mach4 connected to a HiCON CNC machine will do a running toolpath display correctly.
4) Mach4 with ESS plugin, Toolpath display is correct and can run a toolpath display without ESS card connected, however for each new G-Code you must restart Mach4 otherwise it will not display correctly with the next G-Code simulation. (Toolpath does not clear its buffer).
5) In the non connected to CNC machine PC's you must have Sim plugin also ticked i.e. Sim and ESS otherwise it not work.
6) No mater how fast your PC and (like RTX 2060) Nvidia Video cards are, all Nvidia cards will always use 100% when the Toolpath is being displayed and then also run the card very hot with its fans running at max.
7) With AMD low spec cards will run up to 60% usage.
8) No video card in PC will not have an issue.
I hope one day some one at Mach will get these issues ironed out, as not all users do simple 2 and 3 axis CNC machining.
Regards,
Mauri.

Offline Mauri

*
  •  327 327
    • View Profile
Re: Toolpath Display with 4 Axis (solultion found)
« Reply #1 on: June 28, 2019, 07:01:33 PM »
Hi,
I have spent yesterday testing for 8 hours testing and came out disillusioned with hit and miss results on the Test PC and CNC PC's.
Today I did a fresh approach to the problem and after testing every combination I could think off I have finally found the answer.
Tests made with my test PC using Mach4 V4225.
Large 4 axis G-Code with various 1 Million lines tested 7 times in a row with no restart of Mach4 all displayed correctly using method below.
I tried another restart of PC and then started Mach4 and did another 7 times using different G-code samples in a row and all displayed correctly all using the following method below.
1)   Load Mach4 with NO Toolpath screen display on load page.
2)   Load a complex 4 axis G-Code with a lot of lines (or any G-Code that did not display correctly).
3)   Wait up to 2 minutes (dependant on PC speed and amount of G-Code).
4)   Click on display Toolpath and it should display correctly (With G-Code not running but displaying, usage 0-1% GPU load and 0% Fan speed on Nvidia 1070).
5)   Turn Screen back to NO Toolpath screen display.
6)   Press Close G-Code
7)   Press Regen Toolpath (this will blank the Toolpath screen).
8)   Load the next G-Code and redo 1) to 5 above).
9)   Click enable and view Toolpath, then click on Cycle Start, use GPU-Z2.210 Sensor tab and the GPU usage will go to 100% and the GPU temperature will start to rise and eventually the Fans will be tigered on to cool the GPU with large G-Code files.
On smaller 4 Axis G-Code the GPU usage will be less.
AMD cards use less GPU usage I do not know why.
I have found my Mill HiCON PC that has a AMD 1GB runs at 40% GPU using a million lines of code, so a faster one may be less.
On the PC with no card Router Table ESS, it runs about 45% on the GPU using a million lines of code.

So I think this is the solution on making large G-Code display correctly.

Will test it on the CNC PC’s later today to ensure they continually display correctly with this method.

Regards,
Mauri.
Re: Toolpath Display with 4 Axis
« Reply #2 on: June 28, 2019, 08:23:22 PM »
Hi Mauri,
that's great that you have done all that research and posted the results.

I'm wondering if you find that loading Gcode without the toolpath display 'On Load' means that the Code loads
properly and can THEN the toolpath be generated and displayed means that with the two operations (load code and
toolpath generate) being so intensive cause a clash within the CPU. It sort of makes sense.

What happens if you load just a small subset of your code, 5000 lines say? If it loads and generates a correct toolpath it
would tend to suggest that a clash is occurring.

If you modified the <Load Gcode> button or alternately made a new custom button that loaded the Gcode file
using mc.mcCntlLoadGcodeFile() and then waited for Mach to complete before executing mc.mcToolPathGenerate().
Maybe that would automate the process.

Craig
My wife left with my best friend...
     and I miss him!

Offline Mauri

*
  •  327 327
    • View Profile
Re: Toolpath Display with 4 Axis
« Reply #3 on: June 28, 2019, 08:25:50 PM »
Hi,
Tested CNC PC's.
ESS V241 with Mach4 V4225 AMD 1GB I7
HiCON V4225 Mach4 V4225 No video card I5
Mach4 Screen must not have a Toolpath displaying on the Screen Set on loading G-Code.
1 Million line of 4 Axis G-code tested.
Also must set X/Y/Z/A Axis on Screen to Zero on Mach4 before loading G-Code else if loaded make them Zero then regen the Toolpath and wait 2 minutes before displaying Toolpath.
If the PC is slow may have to wait longer before displaying Toolpath.

Best to test the time that suits your PC.

Both PC's had no issues in displaying and running the Toolpath once the above processes where used.

When running the CNC it is best not to continually display the Toolpath as it will heat up the GPU.
When not displaying the GPU usage will be at nearly Zero and the temp very low.

Regards,
Mauri.

Offline Mauri

*
  •  327 327
    • View Profile
Re: Toolpath Display with 4 Axis
« Reply #4 on: June 28, 2019, 08:30:32 PM »
Craig,
Small amount of G-Code is not an issue, however it becomes a problem with larger amount 4 axis code.
As for you suggestion I would have to test it to see if it works.
My screen sets do not have the Toolpath on the front screen.
Regards,
Mauri.

Offline Mauri

*
  •  327 327
    • View Profile
Re: Toolpath Display with 4 Axis
« Reply #5 on: June 28, 2019, 08:40:04 PM »
Craig,
Could you provide the full coding for the button.
My try failed with Lua error issues.
Regards,
Mauri.
Re: Toolpath Display with 4 Axis
« Reply #6 on: June 28, 2019, 09:05:18 PM »
Hi Mauri,
I haven't given a great deal of thought to how to code it and if it would work if I did.

This is what I found (attached pic) behind the <Load Gcode> button of Mach (4125). Note that there is a stock action 'GcodeLoad'.
We can't see the nuts and bolts of the code behind it. Presumably it loads the Gcode file and if the 'Generate Toolpath onLoad'
box is checked it launches the toolpath generator.

What I propose is to substitute some Lua code in place of the stock action. You may wish to leave the stock button alone
and add a custom button for those occasions when you want to load a large file.

Additionally my idea was to compose the code as a series of macro calls. In part its because I am more familiar with
programming macros but it also allows you to use mc.CntlGcodeExecuteWait() type instructions which would specifically
wait for one operation (load Gcode) before trying to generate a toolpath.

Another plus of a the 'series of macros' approach is that you can test Machs state, if it is executing a macro it will have
a particular state which can be distinguished from MachState=idle, ie a macro has completed.

Both of these are the means to ensure sequenced operations, either or both might be required. I will give some more thought
as to how it can be coded over the course of the afternoon (local time).

Craig
My wife left with my best friend...
     and I miss him!
Re: Toolpath Display with 4 Axis
« Reply #7 on: June 28, 2019, 09:21:45 PM »
Hi Mauri,
may I suggest as an experiment try this little piece of code:

Code: [Select]
function m201()
local inst=mc.mcGetInstance()
local filename ='......Gcode File you wish to load.....'
mc.mcCntlLoadGcodeFile(inst,filename)
end
if (mc.mcInEditor()==1)then
m201()
end

Note that I have left the filename for your file to load. We can easily put a file dialogue in later should this idea prove workable.
For this experiment however just substitute the path and filename of a suitable test file.

What I am trying to establish here is whether mcCntlLoadGcodeFile() automatically also starts the toolpath generator
as well. What you would need to do is test this same piece of code (MDI m201) with in one instance with the
'Generate Toolpath On Load' checked and then again with it unchecked.

I suspect and hope that it does not automatically launch the generator. This will be critical if this idea is to work at all.

Craig
My wife left with my best friend...
     and I miss him!
Re: Toolpath Display with 4 Axis
« Reply #8 on: June 28, 2019, 09:26:39 PM »
Hi,
sorry forgot to attach a pic that I mentioned.

Craig
My wife left with my best friend...
     and I miss him!

Offline Mauri

*
  •  327 327
    • View Profile
Re: Toolpath Display with 4 Axis
« Reply #9 on: June 28, 2019, 09:26:55 PM »
Craig,
I made a button with the settings below (pic) and it works.
The function locate is just the button number only it opens the Toolpath display when you press it.
So "Gcode Load" does it all.
I will do more testing but this works with no wait instant after loading the file and it displays correctly.
Regards,
Mauri.