Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: Tarak on December 06, 2012, 11:19:53 PM

Title: Log file?
Post by: Tarak on December 06, 2012, 11:19:53 PM
Is it possible to output the current machine position into a log file every time a certain M code is ran?
So every time the M code is called it just adds X_ _ Y_ _ X_ _ into the log file.
I think something like this would be great for debugging some VB code.
Darc
Title: Re: Log file?
Post by: BR549 on December 06, 2012, 11:33:16 PM
YES


Open"C:/Mach3/DebugLOG.txt" For Append As #1
Print #1,"X: " & GetDro(0)  &"  Y: " & GetDro(1)  &"  Z: "  & GetDro(2)
Close#1
END
Title: Re: Log file?
Post by: Tarak on December 10, 2012, 02:58:56 PM
Oh nice, thanks, I'll give it a go!
Title: Re: Log file?
Post by: Tarak on December 10, 2012, 03:31:53 PM
Thanks BR549, that works great, just on another note.
Is it possible to trim to 4 decimal places rather than 13?
Darc
Title: Re: Log file?
Post by: BR549 on December 10, 2012, 08:44:39 PM
That interesting as HERE that script writes it exactly like it is in the DROs same format.

What version are you running?

(;-) TP
Title: Re: Log file?
Post by: BR549 on December 10, 2012, 08:49:31 PM
Try This

Open"C:/Mach3/DebugLOG.txt" For Append As #1
Print #1,"X: " & Format(GetDro(0),"0000.0000")   &"  Y: " & Format(GetDro(1),"0000.0000")  &"  Z: "  & Format(GetDro(2),"0000.0000")
Close#1
END
Title: Re: Log file?
Post by: Tarak on December 10, 2012, 10:05:15 PM
Thanks BR549, that works great.
BTW, I'm running Version R3.043.066.