Is there a way to validate that the CNC GCode program actually started running?

268 views Asked by At

My current solution to ask the CNC (via ThincAPI) whether or not the program has Completed is not working. It doesn't care if I change programs, once it is successful it will always report true even after changing the loaded program.

What I would like is a variable that I can reset right before firing cycle start so I can check and see if the program truly ran. Ideally I would reset this CycleComplete method that is already being used.

I think what I'm going to end up doing is writing to a macro (common) variable and setting a value, then having the GCode change that value at the very end of the GCode program. Then I will read that value to verify it changed.

Okuma.CMDATAPI.DataAPI.CProgram myCProgram;
myCProgram = new Okuma.CMDATAPI.DataAPI.CProgram();

...

case "cycle":
    string cycle = myCProgram.CycleComplete().ToString();
    Console.WriteLine(" Response: " + cycle);
    return cycle;
2

There are 2 answers

1
Thich Coi Phim On

You might have to check machine in Auto Mode, and running status by using CMachine class with method GetNCStatus () GetOperationMode()

In the case of schedule program, part program is loaded really fast by NC. As a result, you might always see RUNNING status.

Using CV is also a good way to ensure that program have been set/reset.

2
Scott Solmer On

I suspect you must be using an SDF Scheduled Program and the next program is being called before your application has a chance to catch that the previous .MIN program has completed.

The CycleComplete() method will reset when a new program is selected.
If it is returning true and the program in question didn't complete, that is because the subsequent .MIN program completed.

I would suggest putting a Dwell in between the PSelect calls in the SDF to give your app time to catch that the previous .MIN has completed or not.