Running GCode during startup

More
13 Apr 2022 12:15 - 13 Apr 2022 12:16 #240143 by mariusl
Hi
I need to initialize two coordinate systems during startup. In mach3 I used this piece of code in a init.tab file. Mach loads this file during startup.
I would like to run this at startup. Is there a way to do this?

The 5xxx numbers are the G28 home locations

;offsets for tools 100-199
#1 = 0  ;X
#2 = 0   ;Y
#3 = 100 ;Z

;offsets for tools 200-299
#4 = -12.5  ;X
#5 = 108   ;Y
#6 = -100 ;Z

;;;;;;;;;;You should not need to change any of this ;;;;;;;;;;;;

G54
G10 L2 P2 X[#5221 - #1] Y[#5222 - #2]  Z[#5223 - #3]
G10 L2 P3 X[#5221 - #4] Y[#5222 - #5]  Z[#5223 - #6]
M99
 

Regards
Marius


www.bluearccnc.com

Last edit: 13 Apr 2022 12:16 by mariusl.

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

More
13 Apr 2022 17:19 #240164 by spumco
Replied by spumco on topic Running GCode during startup
I believe what you want is to edit your INI file and under the [DISPLAY] section, add the following:OPEN_FILE = /full/path/to/file.ngc - The file to show in the preview plot when AXIS starts. Use a blank string "" and no file will be loaded at start up. gmoccapy will not use this setting, as it offers a corresponding entry on its settings page.

I think if you create an .ngc file - perhaps named startup_offsets.ngc - and added that to the OPEN_FILE= line you could accomplish what you want to do.

Note that the file (your offsets update) won't run automatically, but once you come out of estop and power on the system, you should be able to press cycle start and update the offsets.

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

More
13 Apr 2022 17:26 #240166 by mariusl
Sounds like what I need. I will give that a go. I don't have to change the offsets at any time during run time as there are only two tools. The rotary knife and the pen. Sheetcam sets the G53/G54 when it sends the code for the knife or the pen.

Regards
Marius


www.bluearccnc.com

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

More
13 Apr 2022 18:18 #240171 by rodw
Replied by rodw on topic Running GCode during startup
That will just open a file on startup so not what you want. you need
RS274NGC_STARTUP_CODE
under the RS274NGC section


ref: linuxcnc.org/docs/stable/html/config/ini...l#gcode:ini-features
This is similar to the Mach feature you used to use.
You can add a gcode file here too for more complex setups. eg
RS274NGC_STARTUP_CODE = o<my_custom_startup> call
The following user(s) said Thank You: mariusl, spumco

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

More
14 Apr 2022 07:08 - 14 Apr 2022 07:14 #240210 by mariusl
Thanks Rod. I looked at that at first but from the description I was not convinced that it would work. I will give it a go.

The reason I doubted it was that the variables that is used hold the home positions that are obtained by G28 or G32. This means when the system starts up those are still not valid. They only become valid once the system is homed. Or at least this is my thinking. I am not sure if those variables are non-volatile at all.

Regards
Marius


www.bluearccnc.com

Last edit: 14 Apr 2022 07:14 by mariusl.

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

More
14 Apr 2022 08:13 - 14 Apr 2022 08:55 #240212 by mariusl
I tried it and as I thought nothing happened. I can use the offset table but that means that the operator can fiddle settings.

EDIT: That is only true if there is an error in the code. Nothing is reported but I realized that I made a mistake when I read up on something else. One should not use inline comments at all.

So it works . Thanks Rob

Regards
Marius


www.bluearccnc.com

Last edit: 14 Apr 2022 08:55 by mariusl.

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

More
14 Apr 2022 08:55 #240217 by rodw
Replied by rodw on topic Running GCode during startup
how can you run gcode before its homed to establish the axes?

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

More
14 Apr 2022 08:58 #240218 by mariusl
In this case it only sets the offsets. No action gcode is executed at all. See my comment above. I stuffed up in the code. So it works. Thanks mate.

Regards
Marius


www.bluearccnc.com

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

Moderators: newbynobi
Time to create page: 0.083 seconds
Powered by Kunena Forum