Hi Guys,
I have seen this "mach urban legend" expounded that probing does not work reliably in macros (scripts) several times.
This time, on this morning, I choose to offer an alternate viewpoint...
Let me start with, I am absolutely, NOT, I repeat not, trying to start a flame war of any type.
I speak up now only because dis-information (even when made from the best of intentions), particularly from community members who I respect, concerns me a tad. For context, I've had some conversations where confused, non-expert mach users have asked me about this urban legend.
IMHO, telling people that probing can not be reliable when done from a script is a disservice to the readers of the posts. The (incorrectly IMHO) repetition of this assertion does not help users - it just makes them think that a rather significant part of mach (the entire macro scripting facility) is unreliable.
Why do I have this differing opinion?
To date, I have direct experience with a pretty good size user base that does probing operations, with mach, via scripts, day in and day out, and they have been doing this for between 1 and 2 years now.
Since I developed and market mach enhancement software, the experience has given me some reasonably broad experience from which to form my opinion. I don't have a way to know how many probing operations each user does; So I have no idea how many individual probing operations that all adds up to - but I am pretty sure that it is not a trivially small number.
During the 2 year experience since I started the software project, not one single time have I been able to identify a problem that could even remotely be attributed to the way a G31 command was submitted to mach - be it either via Code("G31") from within a script, or as a G31 block in a G-code file.
Yes, my probing software has had some (usually minor) bugs in it during the last two years, and they were always script logic bugs. At no time, has there ever been an issue, where there was as G31 command that did not work just because it was "from inside" a script.
In fact, (as I'm pretty sure you guys know) in a script, the way that a G31 operation is invoked is by issuing a G31 command - as g-code - via the Code() call. Internal to mach, the script Code() calls and the Gcode interperter both get the G31 command inserted in the code queue. The processing is identical (or so Brian tells me ) from that point on.
The reality is that a script author can write good scripts, and they can write bad scripts. Script quality is not an inherent "a script was used" issue - it's a script author skill level issue.
Are really good scripts easy/trivial to write? Not really, the difficulty level will depend on the programming skills of the author and also on their knowledge of how mach and the target machine operate.
I've looked at a lot of mach scripts in the last 2 years - and the code quality, and the reliability of the script actions varies a lot (!). Again, that's not evidence that scripts are inherently unreliable (it is evidence that the programming skill level of script authors varies).
I know you guys are both pretty good at understanding mach itself. I take at face value that you may have had problems with scripts you have written. And the details of G31 actions can be tricky.
Where I differ is with the implication that probing is not, and can not never be, reliable when used from a script.
Perhaps it would be more accurate to say that "writing complex, professional quality scripts for Mach can be difficult".
OK, I hereby turn off this mini-rant.
(sorry, it was not meant to be a rant, but I fear it could read that way)
Dave