New option to end a program with % or M2
Rick G
Please Log in or Create an account to join the conversation.
- somenewguy
- Offline
- Senior Member
- Posts: 44
- Thank you received: 0
You can use a postamble (such as bye.ngc) as well as a preamble with ngcgui, perhaps that will do what you want.
Rick G
that is super obvious, can't belive I didn't think of it. a % in the preamble and post will net what I want without use of an M2 it seems. Also to note in the past I got hte "this code doesn't end wit ha % or m2" error message, and since I had learend M2 wasn't what I wanted I tried using a % and iirc it still failed and I never understood why. The docs claim you need a % at the begging and end, but I think the error message will say you are lacking a % at the end of your code even if you ONLY have a % at the end. Obviously "begggining" and "end" are non-trivial things for a PC to recognize, but clear to me. Eitherway I was never aware the %s had to wrap your code due to the vague error messages.
but all of that is from memory, I'll see if I can replicate it or if it was just my greeen showing.
On the topic at hand, does a % sign simply tell the interperter "this code is complete enough to execute" and send zero commands to the machine itself? Want to understand exactly what it does, can't find anything in the documents so far.
Please Log in or Create an account to join the conversation.
The idea is that % will just stop the program without all those unwanted changes.
Keep in mind you will have to use the NOM2 option or edit the resulting ngcgui sub before running it it use the % or ngcgui will add a M2 to the end and the % need to be at the beginning.
Rick G
Please Log in or Create an account to join the conversation.
- somenewguy
- Offline
- Senior Member
- Posts: 44
- Thank you received: 0
I am not sure what you mean by NOM2 option, also I can't find the postamble that is being applied to my subs. I see the default preamble std-in.ngc, but there is a single line w/ two comments being appended to the file wit hthe M2 and I don't know where or how to configure that.
Please Log in or Create an account to join the conversation.
If you did not select a postamble then none is being used, the M2 is doing everything.I can't find the postamble that is being applied to my subs. I see the default preamble std-in.ngc, but there is a single line w/ two comments being appended to the file wit hthe M2
M2 does the following
Change from Auto mode to MDI mode.
Origin offsets are set to the default (like G54).
Selected plane is set to XY plane (like G17).
Distance mode is set to absolute mode (like G90).
Feed rate mode is set to units per minute (like G94).
Feed and speed overrides are set to ON (like M48).
Cutter compensation is turned off (like G40).
The spindle is stopped (like M5).
The current motion mode is set to feed (like G1).
Coolant is turned off (like M9).
There is a bit of info here...
linuxcnc.org/docs/html/gcode/overview.html
It is my understanding that if you start with a % and end with a % the last % is just that, end the program. So I am sure to apply a M5 (spindle off) before ending the program an not relying on the end of program or M2 to turn the spindle off.
You can still use a M2 in a program that starts and ends with % however M2 ends the program at the M2 point and noting is read beyond it.
NOM2 is an option for the latest version of ngcgui. Probably only available as a patch or on Master. The default behaviour is for ngcgui to end all subs with a M2, if you select this option then all subs start and end with % and M2 is not automatically added to the end.
To see this create a sub and instead of auto sending it to linuxcnc save it to a file. You can then edit that file before running it to experiment.
Rick G
Please Log in or Create an account to join the conversation.
- somenewguy
- Offline
- Senior Member
- Posts: 44
- Thank you received: 0
Please Log in or Create an account to join the conversation.
ok I think I will continue to sit on 2.5.3, and wait for 2.5.4 to be released.
Might be a long wait, I think the next release will be 2.6
Please Log in or Create an account to join the conversation.
Rick G
Please Log in or Create an account to join the conversation.