Call file as variable from within a file

More
27 Dec 2012 14:41 #28075 by SvenH
In linc you can call an .ngc file from within another .ngc file.

Is it possible to use a variable as a file name so I can use a set of numbered files, starting with 1.ngc and goin on for as long as I have files?

I have found this page that does say files names can be numbers but it does not say if those can be added to an if/then loop or something similar:
linuxcnc.org/docs/html/gcode/o-code.html

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

More
27 Dec 2012 17:05 #28077 by Rick G
If I understand your question, yes you can. Below is an example of calling the file "<part>" which needs to be a ngc file with a numerical name.

www.linuxcnc.org/index.php/english/forum...ling-multiple-copies

Rick G

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

More
27 Dec 2012 17:41 #28081 by SvenH
Hi Rick, thanks for the quick reply.

Can one use a variable for the file name so I can increase the variable with 1 every time the main file runs?
So that the whole list of sub files, numbered from 1 to 10 get milled? (if I need 10 variations)

I want to change one detail in a part that is otherwise the same and pause the main program to lay in a new piece, then mill the next piece with a different sub file, until all sub files have been milled.

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

More
27 Dec 2012 20:29 - 27 Dec 2012 20:30 #28087 by Rick G
Perhaps something like this...

#<part> = 1
start code.....

o100 while [#2] gt 0
G0 Z#5
G0 X0 Y0
;go to sub program
o#<part> call
;safe travel for Z
G0 Z#5

#<part> = [#<part> +1]

code
o100 endwhile

more code......

Rick G
Last edit: 27 Dec 2012 20:30 by Rick G.

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

More
29 Dec 2012 13:37 - 29 Dec 2012 13:39 #28142 by SvenH
Thanks!
I tried it and then found linuxcnc.org/docs/html/gcode/o-code.html to complete the stuff. The file that is called needs some code added as well.

Note that the files that are called need to be in the folder that linc starts looking in after startup which is set in the .ini file of the configuration.
Last edit: 29 Dec 2012 13:39 by SvenH.

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

More
29 Dec 2012 17:13 #28143 by Rick G
Glad you got it sorted out!

Rick G

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

Time to create page: 0.131 seconds
Powered by Kunena Forum