New option to end a program with % or M2

More
13 years 2 months ago #38242 by Rick G
By default NGCGUI ends all subs with a M2 (Program End)

This commands has the following effects:

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).

Note
Lines of code after M2/M30 will not be executed. Pressing cycle start will start the program at the beginning of the file.


M2 is a powerful command and in some cases may be just what you want, however depending on your work flow there may be times when you do not want to issue a M2.

For example if you are working in a coordinate system other the G54 and after the sub runs want to execute MDI commands.
Or if you are using a lathe you probably want to stay in the XZ plane(G18) rather than be switched to the XY plane(G17).

Most of us issue the proper commands either in our preamble or in the start of our subs such as...

G18 (XZ plane)
G20 (inches)
G40 (cancel cutter radius compensation)
G49 (cancel tool length offset)
G90 (absolute distance mode)
G94 (units/min feed rate)
G64 p.001 q.001 (set path following tolerance)

So all is well, but if you normally use MDI commands between running subs you may want the machine left as it was set before the sub.

To do this Dewey has added a new option to NGCGUI on Master called nom2.
You set this option as you would all the other NGCGUI options.

With this option your NGCGUI sub will start and stop with a % instead of ending with a M2.
You can still use your post amble to add the commands you wish to execute upon completing such as M5, M9 etc.

Thanks Dewey.

Rick G

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago - 13 years 2 months ago #38271 by andypugh

Rick G wrote: By default NGCGUI ends all subs with a M2 (Program End)

This commands has the following effects:

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).


For example if you are working in a coordinate system other the G54 and after the sub runs want to execute MDI commands.
Or if you are using a lathe you probably want to stay in the XZ plane(G18) rather than be switched to the XY plane(G17).


Have you checked if this is actually all true?

I haven't _noticed_ being sent back to G54 and XY on my lathe, but maybe I wouldn't.
Last edit: 13 years 2 months ago by andypugh.

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago - 13 years 2 months ago #38303 by BigJohnT
Rick's quote is from the manual so it has to be true...

JT
Last edit: 13 years 2 months ago by BigJohnT.

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #38305 by Rick G

Have you checked if this is actually all true?


Naturally. I would not post the information here if I had not checked it out.

Perhaps I should have referenced the quote...

linuxcnc.org/docs/html/gcode/m-code.html#sec:M2-M30

You can confirm on your lathe by...

Start lathe
Touch off in G54
Move to a different location.
Touch off in G55

From MDI issue and watch the display and the active G codes...
G55
G54
G55
G18
M2

Rick G

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #38310 by ArcEye

Rick G wrote:

Have you checked if this is actually all true?

Naturally. I would not post the information here if I had not checked it out.


I can vouch for that, it has caused me problems in the past.

I was used to using M30 a lot, because it means rewind on a lot of controllers, not end the program and reset everything.
It is not really noticable until you start using several co-ordinate systems or cutter compensation.

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #38340 by andypugh
Sorry chaps, I think I failed to notice which section this was in (the perils of trying to read all of the forum). (I don't like the forum format for things I want to know I have read all of).
M2 is M2 and M30 is M30 and % is just the end. It's nice that NGCGUI offers the option. It might be worth there being a very explicit section in the manual on the different ways to end a program. (Or, if it already exists, can I have the link because this is all a bit of a surprise to me. I probably need to spend more time actually making stuff)

Please Log in or Create an account to join the conversation.

Time to create page: 0.390 seconds
Powered by Kunena Forum