Machsupport Forum
G-Code, CAD, and CAM => G-Code, CAD, and CAM discussions => Topic started by: Marcwolf on December 16, 2025, 02:18:51 PM
-
Hi. We have an issue where we have to run our machine between certain times. We can view it via a cameras.
So I am wondering if anyone has a script that can read the system time and when it is 8am it starts the job, and a 5pm it does a feed hold until 8am the next day.
And continue this till it is the job is done.
I am a VB programmer and have an idea of how it can be done using While.. Loops and Sleep to keep thing running.
Longer Story. We have a big CNC (2.4m x 1.2m) in a Mens Shed that only opens Mon - Wends from 9am to 12pm. This is a very small window to do very large jobs. i.e. slice of a tree getting a sign engraved onto it. Unfortunately the shed also had neighbours who complains about after hours time so we cannot run this 24hrs a day till the job is finished.
Any help is greatly appriciated.
Many thanks
Dave
-
I have whipped up this pseudo code that should do it. you start by tunning this when you ready to start the job..
Const StrtTime = ' mins at 8am
Const EndTime = ' mins at 5pm
Var iRunning as Boolean
Var oRunning as Boolean
iRunning = True
oRunning = True
Start the Job
While Job_active ' Checks that the current job is running and not finished
Get System Time in minutes from midnight
If system time between StrtTime and EndTime then
iRunning = False
Else
iRunning = True
End if
Do ' Stop testing too quickly. We are not worried about seconds
Wait 5 mins
sleep
Loop
If oRunning <> iRunning
if iRunning = False
FeedHold
oRunning = False
else
Run Job
oRunning = true
end if
end if
Loop