Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: HimyKabibble on September 10, 2009, 12:17:29 AM

Title: How To Tell When A G-Code Program Is Running?
Post by: HimyKabibble on September 10, 2009, 12:17:29 AM
How can you tell, in a VB script, if a g-code program is currently running?

Regards,
Ray L.
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: poppabear on September 10, 2009, 07:43:18 AM
Yes, Look at the "cycle Start" LED, the only time it is on, is when the G code is running.

scott
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: Bodini on October 26, 2009, 10:09:17 AM
But, if your gcode has a macro, the cycle start light goes out when the macro is running.

Update:  I stand corrected.  Its when you type a macro in the MDI that the cycle start doesnt light up.
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: sunangel on October 26, 2009, 11:29:27 AM
Then how do we tell weather a gcode program is loaded? I know it's off topic, but it's best not to open a thread that is partially related, i think. =)
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: melee on October 26, 2009, 01:43:02 PM
Hi

currentfile = FileName() will get the name of the loaded .NC file as a string

Testing the return will determine if there is one loaded.
( If (!currentfile.IsEmpty()) {}  or If (strlen(currentfile)) {} type of thing in C++ or C, or something clunkier in VBS)

There are undoubtedly other ways to do the same thing.

regards

Melee
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: sunangel on October 26, 2009, 11:31:30 PM
Uhm, so how is it possible to write in VB???
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: melee on October 27, 2009, 03:44:50 AM
Hi

I  don't use VB, except where I have to for Mach.

Looking at the reference material, ( always a good move ) the below is a starting basis

Dim currentfile As String

currentfile = ""   // ensure string is empty before you start

currentfile = FileName()
If Len(currentfile) Then
         //  Do whatever you want to if you find a .NC file is already loaded here
End If

I have put together all the references I found on VBS when I was writing macros HERE (http://myweb.tiscali.co.uk/drahthaar/CNC/VBS_info.zip) for download.

When you have read them you will know as little as me.

regards

Melee
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: sunangel on October 27, 2009, 07:43:00 AM
Thank you very much melee! Though I've been VB coding on Mach3 for a few years, i don't have such important infos like you have collected! Thank you melee!
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: Bodini on October 30, 2009, 10:26:44 AM
One more thing to the OP.  The cycle start light goes off during and M1 pause.
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: zealous on December 19, 2009, 12:47:31 AM
It is undocumented but:
G-Code is Loaded LED 172
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: Bodini on December 19, 2009, 08:46:40 AM
Son.
Of.
A.
Mofo.

Got any other classified info up your sleeve?  Guess that tidbid outta make it to the wiki.  Thanks, Jason.

/nick
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: Vogavt on February 07, 2015, 09:26:18 AM

I have put together all the references I found on VBS when I was writing macros HERE (http://myweb.tiscali.co.uk/drahthaar/CNC/VBS_info.zip) for download.


Anyone happen to have the VBS_info.zip that is no longer available at the above link?

Would love to take a peek at it.
Title: Re: How To Tell When A G-Code Program Is Running?
Post by: BR549 on February 07, 2015, 02:01:09 PM
There are 3 things to look at to tell IF a Gcode FILE is loaded and running. IT MAY NOT  work IF a macro (M6) is running a tool change

 GetOemLed(172) ----->  IF TRUE then a Gcode is loaded
 GetLED(4)           -----> IF TRUE then CYCLE START is active
 GetLed(5)           -----> IF  TRUE then in FEEDHOLD (pause)

Note there are instances when Mach3 is running a GCODE that you can be in FEEDHOLD and the Cycle start LED will be ON.
AND in some instances whle in Feedhold the LED will be ON. IT just depends on what  Mach3 is doing when you FEEDHOLD.

So you have to account for that as well.

(;-) TP



Title: Re: How To Tell When A G-Code Program Is Running?
Post by: BR549 on February 07, 2015, 02:24:08 PM
UPDATE (;-)

Further Testing, Looks like

GetLed(172)
GetLed(4)

Will do the JOB. BUT you MAY be able to only use

GetLed(4)  ----> Cycle Start