Job is running status

Make your own CNC Control Apps

Moderator: cnckeith

Post Reply
corbin
Posts: 73
Joined: Fri Nov 08, 2024 2:57 pm
Acorn CNC Controller: Yes
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 3484E42757Cd-1018248693
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Job is running status

Post by corbin »

Hello! I'm trying to find out if a job is running or not. Specifically, the filename that is loaded. The trouble I'm having is that SV_JOB_IN_PROGRESS returns IO_LOGICAL_1 even when I'm running a warmup routine, and haven't actually started the job. Is there a way to differentiate this?

Thanks!

Corbin

My code:

Code: Select all

        public static bool IsJobRunning(this CNCPipe pipe)
        {
            CNCPipe.Plc.IOState plcState = CNCPipe.Plc.IOState.IO_STATE_UNKNOWN;
            CNCPipe.ReturnCode rc = pipe.plc.GetPcSystemVariableBit(CentroidAPI.PcToMpuSysVarBit.SV_JOB_IN_PROGRESS, out  plcState);
            if (rc == CNCPipe.ReturnCode.SUCCESS)
            {
                return plcState == CNCPipe.Plc.IOState.IO_LOGICAL_1;

            } else
            {
                return false;
            }
        }
I'm also curious about this method on CNCPipe.State, but it is internal:

Code: Select all

        internal bool CheckIfJobIsRunning()
        {
            if (File.Exists("C:\\cncm\\loadcommand.txt"))
            {
                return true;
            }

            string command = "STATE_CheckIfJobIsRunning";
            m_parent.SendAndReceive(command, out var response);
            FromString(response, out var value);
            return Convert.ToBoolean(Convert.ToInt32(value));
        }


ASPeters
Posts: 48
Joined: Thu Feb 10, 2022 5:55 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Job is running status

Post by ASPeters »

There is not currently a way to determine which specific job is running, only that a job is running. Checking SV_JOB_IN_PROGRESS or SV_PROGRAM_RUNNING are the best ways to determine that.

CheckIfJobIsRunning has been retooled into IsJobRunning for the upcoming v5.40 release. It does a more programmatic way of checking the same information, without having to query the board. This would be a faster call to make in the future but does not help your current issue.

Let me mull it over some and I will see what I can come up with for you.


corbin
Posts: 73
Joined: Fri Nov 08, 2024 2:57 pm
Acorn CNC Controller: Yes
Plasma CNC Controller: No
AcornSix CNC Controller: No
Allin1DC CNC Controller: No
Hickory CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: 3484E42757Cd-1018248693
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Job is running status

Post by corbin »

Thanks! Is there a difference between SV_JOB_IN_PROGRESS and SV_PROGRAM_RUNNING? I haven't poked around at SV_PROGRAM_RUNNING.

Maybe one could indicate the GCode file is running, and another could indicate that anything else is running (ie: macros via the VCP, MDI, etc)?

Corbin


ASPeters
Posts: 48
Joined: Thu Feb 10, 2022 5:55 pm
Acorn CNC Controller: No
Allin1DC CNC Controller: No
Oak CNC controller: No
CNC Control System Serial Number: none
DC3IOB: No
CNC12: Yes
CNC11: No
CPU10 or CPU7: No

Re: Job is running status

Post by ASPeters »

corbin wrote: Wed Jul 16, 2025 12:34 pm Thanks! Is there a difference between SV_JOB_IN_PROGRESS and SV_PROGRAM_RUNNING? I haven't poked around at SV_PROGRAM_RUNNING.
SV_PROGRAM_RUNNING is 1 if in the MDI screen or a job is in progress
SV_JOB_IN_PROGRESS is 1 if a MDI command is running (not just idly sitting there) or a job is in progress


Post Reply