on_abort macro not found when code is encapsulated in %

More
11 Nov 2020 14:54 #189005 by mydani
Hello,

my postprocessor generates a % as first and last line of gcode - background is, I want to keep the settings used in GCODE, e.g. work coordinate offset, G95, G96, etc. Unfortunately, when I load a file like this and then press escape, my "on_abort" macro is not found anymore. If I load another file which has M2/M30 and no %, on pressing escape the "on_abort" macro is executed.

Do you have any hints?

Regards,
Daniel

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

More
11 Nov 2020 15:25 #189010 by tommylight

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

More
11 Nov 2020 15:34 #189011 by mydani
Even without CAM, just by writing the code manually, this happens.

%
G59
... do some milling here ...
M5
M9
%

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

More
11 Nov 2020 17:41 #189019 by tommylight
I asked what CAM software you are using to generate gcode.
Anyway, use % or M2 or both, but since % causes issues, use only M2 at the end.

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

More
11 Nov 2020 17:50 #189020 by mydani
InventorHSM. But of course manipulated by me to not post M2.

In the documentation it says:
A G code file must contain one or more lines of G code and be terminated with a Program End. Any G code past the program end is not evaluated.

If a program end code is not used a pair of percent signs % with the first percent sign on the first line of the file followed by one or more lines of G code and a second percent sign. Any code past the second percent sign is not evaluated.

Warning
Using % to wrap a G code file will not do the same thing as using a program end. The machine will be in what ever state the program left it in using %, the spindle and coolant may still be on and things like G90/91 are left as the last program set them. If you don’t use a proper preamble the next program could start in a dangerous condition.

It is unclear whether the M2 would be executed if there is a % at beginning and before the M2 at the end.
I will try tomorrow and find out.

Regards,
Daniel

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

Time to create page: 0.371 seconds
Powered by Kunena Forum