Hello Guest it is October 15, 2019, 08:30:48 PM

Author Topic: Gcode logging/tracing  (Read 2215 times)

0 Members and 1 Guest are viewing this topic.

Gcode logging/tracing
« on: March 13, 2012, 08:24:54 AM »
Is there a way to log or trace all Gcode instructions to a file?  Many of my Gcode programs use variables, and I would to see the actual Gcode instructions with the real values (not variables).  Attached is an example Gcode program.  It measures the inside depth of a part, then cuts a slot in a single CNC operation.  It's nice to have a record of the actual Gcode that got run.  Maybe an option to allow all Gcode instructions to be written to the Teach file?  The Mach3 Teach facility currently only logs Gcode instructions run from the MDI window and macros.

I have also done the same with a macro using my own custom logging and tracing, but that seems to be more complicated than necessary.  

In the attached Gcode program I need to see the actual Gcode instructions that got run, after the variables have been resolved.
« Last Edit: March 13, 2012, 08:31:50 AM by sittinduck »

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: Gcode logging/tracing
« Reply #1 on: March 13, 2012, 12:48:09 PM »
Double post
« Last Edit: March 13, 2012, 12:52:07 PM by BR549 »

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: Gcode logging/tracing
« Reply #2 on: March 13, 2012, 12:50:35 PM »
Is it possible??   YES.  Probably fairly simple. 

Has it been done with MACH3?    NOT that I know of.

THere are programs to do Fanuc and other styles Macros with variables.

Brian has made noise of including something close in mach4. Being able to see the #var values on the fly while running a Gcode program.

Maybe one of the savy programmers on here will take the challenge(;-)

(;-) TP
Re: Gcode logging/tracing
« Reply #3 on: March 14, 2012, 08:01:29 PM »
So is it possible to intercept the Gcode before it's sent to the controller?  I need an audit trail of all Gcode instructions with parameters resolved to values for the purpose of hunting down errors.  As you can see in the attached NC, it's hard to tell what the Gcode program actually did since most of the calculations are based on a measurement that's not known until the program starts.

A parameter is the # character followed by a number 1 to 10320.  Previously I referred to these as variables.  These are what need to be resolved to values in a Gcode trace, audit trail, or whatever you'd like to call it.

Can this be done with a VB macro, or does it require the Mach C/C++ SDK?  If someone points me in the right direction, I'll figure out the rest.  Thank you.


Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: Gcode logging/tracing
« Reply #4 on: March 14, 2012, 08:47:11 PM »
You should be able to just parse through the Gcode and do the math as the gcode does making reference to the #vars.  In most cases you are not depending on being at a positional value as Mach3 gcode does NOT have direct access to that info via a #var.

Somewhere there is probably a hook into the #vars real values from the SDK side. OR NOT(;-)

You would need to ask Brian  if it is possible ON THE FLY.

There is a simple VAR monitor in Mach3 that allows you to see the #VAR value live. OR you COULD create a set of DROS to display var values live.



Just a thought(;-) TP
Re: Gcode logging/tracing
« Reply #5 on: March 14, 2012, 09:15:29 PM »
A Gcode audit trail would generate a timestamped trace file each time a Gcode program is run.  I would only look at these files in case of a problem or machining error.

Yes, the loaded Gcode program could be interpreted by a VB macro once the measurements are known, to generate a simulated Gcode trace file.  However, the subroutines would need to be expanded because there's math inside them also.  I sometimes do incrementing or counting inside the subroutines.