1

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;
  • 1
    not related to answer, but I used to run an OKUMA, that was my favorite CNC machine! – Koosh Jul 29 '19 at 17:06
  • Are you also checking the Active Program FileName / Program Name? – Scott Solmer Jul 30 '19 at 13:31
  • I am. The idea was to load a new program, attempt to run it, then check to see if it ran successfully. Validating using `CycleComplete` and `GetActiveProgramFileName`. – nathanbussey Jul 30 '19 at 14:18
  • 1
    What about checking the MacMan class? The Machining Reports will tell you when a program started and how long it ran. Also, changing the loaded program should Reset the NC which resets the CycleComplete response... So that's odd. – Scott Solmer Jul 31 '19 at 14:23
  • Changing the loaded program is definitely not resetting in the simulator I'm using. – nathanbussey Jul 31 '19 at 18:50

2 Answers2

2

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.

0

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.

Scott Solmer
  • 3,871
  • 6
  • 44
  • 72
  • I'm using Okuma.CMCMDAPI.CommandAPI.CProgram().SelectMainProgram() to set the program using the file name. In the simulator I'm using it is definitely not resetting CycleComplete(). I will add a longer dwell and revalidate, but that solution doesn't work very well for very small programs. – nathanbussey Aug 06 '19 at 16:54
  • To validate the problem, try using the THINC API Mill sample application on the machine to see if you get a different result. – Scott Solmer Aug 07 '19 at 16:17