Stop and restart program
- albova
- Offline
- Senior Member
- Posts: 43
- Thank you received: 0
I have a rather long gcode
I also have a sub that controls the tool length every n times that g0 is executed and if the tool is within the tolerance date the program continues.
question:
if the tool is not within the tolerance, I have to stop the program and change the tool. How do I start from the point where it left off ?
I also need to know the line number from where to start.
Whatever idea is well accepted
Thank you
Please Log in or Create an account to join the conversation.
- ArcEye
- Offline
- Junior Member
- Posts: 25
- Thank you received: 761
I also have a sub that controls the tool length every n times that g0 is executed and if the tool is within the tolerance date the program continues.
question:
if the tool is not within the tolerance, I have to stop the program and change the tool. How do I start from the point where it left off ?
You probably need to explain your subroutine a bit more. Exactly how does it determine if the tool is worn beyond tolerances?
Probing a contact?
If worn, what type of tool change is required? Manual - switch to identical tool in another bay?
Is there scope to incorporate a conditional tool change in the sub, then resume?
To resume a program, you right click on the line to continue from and click on 'Run From..'
It needs to be a linear move of at least the diameter of the tool, so possibly several lines back from where you halted and you need to set spindle running at speed and feed rate manually first, so that might affect its placement
regards
Please Log in or Create an account to join the conversation.
- albova
- Offline
- Senior Member
- Posts: 43
- Thank you received: 0
The purpose is given by gcode very long (nesting of engravings) and a further problem is to know which line the gcode stopped.
Should I store the feed rate current at the point where I'm going to check the tool and after launching a program with a button that turns on the spindle and adjusts the feed rate with the one previously stored. Subsequently launch the program with "start from here"
is there a system to do this?
Please Log in or Create an account to join the conversation.
- ArcEye
- Offline
- Junior Member
- Posts: 25
- Thank you received: 761
Other controllers have facility to 'Start from block NN..', the controller searching back to get the last spindle speed, feed etc. the move normally restarting at a safe Z height and re-entering the path from there.
Linuxcnc does not and re-starting a file is best avoided.
It is often actually better to split the code up into a series of discreet files and do whatever is required between them.
Without seeing your code, it is impossible to tell if the tests you are making and the manner of them could be improved.
You have not said what the mechanism is that counts your G0 moves and determines that a check is required and when that check is done, immediately or before the next loop.
You should never stop inside a conditional loop. The line number is meaningless when the position is determined by one or more other variables.
Likewise you should not stop inside a subroutine.
There are methods to programatically determine the current line number, but they are not always accurate.
emcStatus->task.currentLine , emcStatus->task.motionLine and emcStatus->task.readLine, can all return different values and sometimes none of them are right
I would recommend you 'design out' the majority of your problems, resuming from a stored speed and feed in itself, is not a problem.
regards
Please Log in or Create an account to join the conversation.
- albova
- Offline
- Senior Member
- Posts: 43
- Thank you received: 0
Inside the sub, a variable count them and when it reaches the set value, performs control tool on the probe.
I think I have solved:
if the tool is worn out, instead of stopping the program, I put it on pause.
Doing so, the operator, before stopping the program, writes the line and when pressed the button to continue, the tool moves in the change position and here the program stops.
What do you think about it ?
From simulated tests, it works.
regards
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23560
- Thank you received: 4858
linuxcnc.org/docs/2.7/html/gcode/overvie...ned-named-parameters
Please Log in or Create an account to join the conversation.
- albova
- Offline
- Senior Member
- Posts: 43
- Thank you received: 0
the command (DEBUG, # <_line>) works correctly in the main gcode
obviously it does not work in sub but solve my case.
many thanks to all for the help
Alessandro
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23560
- Thank you received: 4858
the command (DEBUG, # <_line>) works correctly in the main gcode
obviously it does not work in sub but solve my case.
In that case, you could replace every call to the sub
O<ctrl_tool> CALL
O<ctrl_tool> CALL [#<_line>]
O<ctrl_tool> SUB
(DEBUG, subroutine called by line #1)
ie, pass the number of the calling line to the subroutine. You could extend this to suggest a spindle speed to set before restart too,
Please Log in or Create an account to join the conversation.
- albova
- Offline
- Senior Member
- Posts: 43
- Thank you received: 0
the system works
to restore the speed of work I thought of using the mdi simply entering "Fxxx" , but when I restart the program "run from here", do not seem to have it loaded
Fxxx command is not read by the operator mdi?
regards
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
- Posts: 23560
- Thank you received: 4858
linuxcnc.org/docs/2.7/html/gcode/m-code.html#mcode:m70
Please Log in or Create an account to join the conversation.