Mach4 works with cautions
Posted: Sun Dec 11, 2016 6:15 am
Hi All,
have in recent days migrated from Mach3 and parallel port to Mach4 and a SmoothStepper external motion control card
and have had some challenges getting Autoleveller to work with the new combination.
As has been reported on a similar thread on this forum Mach4 uses different # variable numbers. A find-and-replace edit is
required to get the early generations of Autoleveller to work, but work they do.
My own work flow absolutely requires the added functionality that a probe file confers, ie Autoleveller0.8.7, know as AL,
and its immediate forbears, and AutolevllerAE v0.7.8, known as AE.
Mach4 does not have native support for opening and closing probefiles, that functionality is conferred by appropriate macros.
Two examples are shipped with Mach4: M400 and M401 in the ...\Mach4Hobby\Lua Examples folder. With a few keystrokes
editing and renaming they behave in identical fashion to Mach3. I have attached them should you wish, note also that I had to
rename them as text files in order to post them. Change them back to Mxx.mcs and put them in your current ...\profile\macros
folder.
I have encountered two not insurmountable problems in getting useful code from either AL or AE.
The first issue, and I suspect and hope is confined to my machine, is that Mach4 records a random number more data triplets
in the probefile than the number of probe cycles commanded by AE/AL. I have yet to resolve why. Certainly neither AL/AE
will produce any useful results with such nonconforming data. I would strongly recommend that you open your probefile
in either Notepad++ or a spreadsheet and check that there is in fact the right number of data triplets to match AL/AE mesh points.
The second issue concerns how Mach4/controller gathers the data triplets, Mach4 reports the actual X,Y position at the probe
event whereas the PP equipped Mach installations report the programed X,Y position. Inevitably there will be a small error
between the two. Neither AL or AE behave well if the error is significant. AL has a tolerance built in (0.02 units) which allows
probefiles generated by my machine to work. AE on the other hand requires near identical (one digit rounding in the fourth
decimal place) or it will fail to recognise the probefile or give wild Z variations if it does.
If I manually edit the probfile X,Y positions to match the expected and exact mesh points of AE it works well. A tedious rather
than difficult edit. I measured the rms variation of my machine from theoretical best as 0.0225mm.
I indicated to James my intention to author a program or module to facilitate the procedure and have been working at fever
pitch to produce such code. I have made good progress. Working in Lua the Mach4 scripting environment I have working
code. AE conveniently uses G1 codes to command the X,Y preposition moves and makes for a fairly simple 'strip' to produce
the mesh positions from the Gcode file, no navigating file directories required, its part of the M41 close macro. The same macro
also opens the probefile just generated and checks for extra or unintended entries and as they are duplicates, at least on my
machine, and strips the offending duplicates. It then produces a corrected probefile and offering a tolerance warning in case of
larger error than anticipated, 0.02 units, per AL practice. Lua does have some simple string functions that with care an
imagination can be made quite effective. Whether they be computationly efficient is another matter. My practice probefile
is 11kB with 210 probe points and processing near instantaneous. A proficient programmer like James may well shake his head
in askance at my efforts but as he lives on the other side of the world I can probably 'blow raspberries at him' without great offence!
I will spend a few days or even a week trying to polish the code and if possible make it a little more robust, it's quite sensitive
to file/data format. I would also like to test it more by running multiple files thru it. If anyone is desperate for them or is willing
to help with the testing, by all means let me know.
Last word, when AE/AL go cranky they can do so in subtle ways and in restricted locations of the board. Thorough toolpath
checking with a simulator or viewer is mandatory before committing it to your hardware.
Craig
have in recent days migrated from Mach3 and parallel port to Mach4 and a SmoothStepper external motion control card
and have had some challenges getting Autoleveller to work with the new combination.
As has been reported on a similar thread on this forum Mach4 uses different # variable numbers. A find-and-replace edit is
required to get the early generations of Autoleveller to work, but work they do.
My own work flow absolutely requires the added functionality that a probe file confers, ie Autoleveller0.8.7, know as AL,
and its immediate forbears, and AutolevllerAE v0.7.8, known as AE.
Mach4 does not have native support for opening and closing probefiles, that functionality is conferred by appropriate macros.
Two examples are shipped with Mach4: M400 and M401 in the ...\Mach4Hobby\Lua Examples folder. With a few keystrokes
editing and renaming they behave in identical fashion to Mach3. I have attached them should you wish, note also that I had to
rename them as text files in order to post them. Change them back to Mxx.mcs and put them in your current ...\profile\macros
folder.
I have encountered two not insurmountable problems in getting useful code from either AL or AE.
The first issue, and I suspect and hope is confined to my machine, is that Mach4 records a random number more data triplets
in the probefile than the number of probe cycles commanded by AE/AL. I have yet to resolve why. Certainly neither AL/AE
will produce any useful results with such nonconforming data. I would strongly recommend that you open your probefile
in either Notepad++ or a spreadsheet and check that there is in fact the right number of data triplets to match AL/AE mesh points.
The second issue concerns how Mach4/controller gathers the data triplets, Mach4 reports the actual X,Y position at the probe
event whereas the PP equipped Mach installations report the programed X,Y position. Inevitably there will be a small error
between the two. Neither AL or AE behave well if the error is significant. AL has a tolerance built in (0.02 units) which allows
probefiles generated by my machine to work. AE on the other hand requires near identical (one digit rounding in the fourth
decimal place) or it will fail to recognise the probefile or give wild Z variations if it does.
If I manually edit the probfile X,Y positions to match the expected and exact mesh points of AE it works well. A tedious rather
than difficult edit. I measured the rms variation of my machine from theoretical best as 0.0225mm.
I indicated to James my intention to author a program or module to facilitate the procedure and have been working at fever
pitch to produce such code. I have made good progress. Working in Lua the Mach4 scripting environment I have working
code. AE conveniently uses G1 codes to command the X,Y preposition moves and makes for a fairly simple 'strip' to produce
the mesh positions from the Gcode file, no navigating file directories required, its part of the M41 close macro. The same macro
also opens the probefile just generated and checks for extra or unintended entries and as they are duplicates, at least on my
machine, and strips the offending duplicates. It then produces a corrected probefile and offering a tolerance warning in case of
larger error than anticipated, 0.02 units, per AL practice. Lua does have some simple string functions that with care an
imagination can be made quite effective. Whether they be computationly efficient is another matter. My practice probefile
is 11kB with 210 probe points and processing near instantaneous. A proficient programmer like James may well shake his head
in askance at my efforts but as he lives on the other side of the world I can probably 'blow raspberries at him' without great offence!
I will spend a few days or even a week trying to polish the code and if possible make it a little more robust, it's quite sensitive
to file/data format. I would also like to test it more by running multiple files thru it. If anyone is desperate for them or is willing
to help with the testing, by all means let me know.
Last word, when AE/AL go cranky they can do so in subtle ways and in restricted locations of the board. Thorough toolpath
checking with a simulator or viewer is mandatory before committing it to your hardware.
Craig