- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- "Named" file subroutine call fails; "Numbered" ok
"Named" file subroutine call fails; "Numbered" ok
30 Dec 2013 09:02 - 31 Dec 2013 03:18 #42188
by clunc
"Named" file subroutine call fails; "Numbered" ok was created by clunc
EDIT: SOLVED. I used UPPERCASE for subroutine's FILENAME, against documentation's express information. (Thank you dgarrett and ArcEye.)
Sometimes you get so blind it's hard to see.
Just reporting.
Pulled my hair out. (Put to the side for later look into possible re-attachment.)
The main program calls a subroutine file O104C_FX.ngc [EDIT: My mistake. o104c_fx.ngc would have been fine.] with:
O<o104c_fx> call
The external subroutine file O104C_FX.ngc file contains:
O<o104c_fx> sub
(some g-code)
O<o104c_fx> endsub
M2
But on loading the main file, AXIS in LinuxCNC 2.5.3 complains:
"cannot open (or find, I forget) file o104c_fx"
I know about PROGRAM_PREFIX which I've set in [DISPLAY] in the INI file to:
/home/username/cncmodels,
and SUBROUTINE_PATH which I've set, in the correct section I forget, to:
/home/username/cncmodels:/home/username/linuxcnc/nc_models
And I've copied the file O104C_FX.ngc to BOTH
locations in the SUBROUTINE_PATH.
With no resulting happiness. (In fact with hair-pulling frustration...)
BUT change the filename to "100.ngc" and all the various
references to "O<100>"--WITHOUT changing locations or variable
values or anything else--and Joy Abounds. (It's executing this very moment.)
I experimented quite a bit (removed the underscore, removed uscore AND numbers, etc.)
and the ONLY thing I found that worked was to Name The Subroutine File with Numbers.
I am satisfied the documentation is not correct on this point.
I am satisfied the documentation could make the point more strongly.
Sometimes you get so blind it's hard to see.
Just reporting.
Pulled my hair out. (Put to the side for later look into possible re-attachment.)
The main program calls a subroutine file O104C_FX.ngc [EDIT: My mistake. o104c_fx.ngc would have been fine.] with:
O<o104c_fx> call
The external subroutine file O104C_FX.ngc file contains:
O<o104c_fx> sub
(some g-code)
O<o104c_fx> endsub
M2
But on loading the main file, AXIS in LinuxCNC 2.5.3 complains:
"cannot open (or find, I forget) file o104c_fx"
I know about PROGRAM_PREFIX which I've set in [DISPLAY] in the INI file to:
/home/username/cncmodels,
and SUBROUTINE_PATH which I've set, in the correct section I forget, to:
/home/username/cncmodels:/home/username/linuxcnc/nc_models
And I've copied the file O104C_FX.ngc to BOTH
locations in the SUBROUTINE_PATH.
With no resulting happiness. (In fact with hair-pulling frustration...)
BUT change the filename to "100.ngc" and all the various
references to "O<100>"--WITHOUT changing locations or variable
values or anything else--and Joy Abounds. (It's executing this very moment.)
I experimented quite a bit (removed the underscore, removed uscore AND numbers, etc.)
and the ONLY thing I found that worked was to Name The Subroutine File with Numbers.
I am satisfied the documentation could make the point more strongly.
Last edit: 31 Dec 2013 03:18 by clunc.
Please Log in or Create an account to join the conversation.
30 Dec 2013 10:13 #42191
by dgarrett
Replied by dgarrett on topic "Named" file subroutine call fails; "Numbered" ok
linuxcnc.org/docs/html/gcode/o-code.html
"The file name can include lowercase letters, numbers, dash, and underscore only."
...
"Note
The file names are lowercase letters only so o<MyFile> is converted to o<myfile> by the interpreter. More information about the search path and options for the search path are in the INI Configuration Section."
"The file name can include lowercase letters, numbers, dash, and underscore only."
...
"Note
The file names are lowercase letters only so o<MyFile> is converted to o<myfile> by the interpreter. More information about the search path and options for the search path are in the INI Configuration Section."
Please Log in or Create an account to join the conversation.
30 Dec 2013 12:44 #42194
by clunc
Replied by clunc on topic "Named" file subroutine call fails; "Numbered" ok
Precisely the quote which should read:
"The file name can include numbers only."
"The file name can include numbers only."
Please Log in or Create an account to join the conversation.
30 Dec 2013 15:45 - 30 Dec 2013 18:04 #42195
by ArcEye
Replied by ArcEye on topic "Named" file subroutine call fails; "Numbered" ok
Hi
Named subs work fine, you are just doing it wrong.
Linux is case sensitive and additionally the interpreter converts to lower case.
You have a subroutine named in lowercase, within a file with a name which contains uppercase letters
ie. the filename is not the same as the sub name as far as linux is concerned
Just make it simple, call the sub mysub and the file mysub.ngc, so long as the paths are correct, it will just work
PS it is a good idea to always call the sub in lowercase too
eg
o<subname> call
then there is no chance of hitting zero instead of O when you type it (or at least not noticing you did it )
regards
Named subs work fine, you are just doing it wrong.
Linux is case sensitive and additionally the interpreter converts to lower case.
You have a subroutine named in lowercase, within a file with a name which contains uppercase letters
ie. the filename is not the same as the sub name as far as linux is concerned
Just make it simple, call the sub mysub and the file mysub.ngc, so long as the paths are correct, it will just work
PS it is a good idea to always call the sub in lowercase too
eg
o<subname> call
then there is no chance of hitting zero instead of O when you type it (or at least not noticing you did it )
regards
Last edit: 30 Dec 2013 18:04 by ArcEye.
Please Log in or Create an account to join the conversation.
31 Dec 2013 03:09 #42204
by clunc
Replied by clunc on topic "Named" file subroutine call fails; "Numbered" ok
Ah, I see, with apologies to dgarrett for my earlier failure to read the WHOLE thing: "...the filename can contain LOWERCASE letters, numbers, dash, and underscore only."
(I went right past that word 'lowercase'.)
And, thanks, ArcEye, for turning me around to look at it again.
Because the subroutine name, SUBNAME, is going to be mapped to all-lower case in:
o<SUBNAME> call
then, the subroutine it calls must be designated as lowercase:
o<subname> sub
o<subname> endsub
AND the file in which it is found must be named with lowercase:
subname.ngc.
(I, pugnaciously, still don't think the documentation makes that point as well as you just did.)
(I went right past that word 'lowercase'.)
And, thanks, ArcEye, for turning me around to look at it again.
Because the subroutine name, SUBNAME, is going to be mapped to all-lower case in:
o<SUBNAME> call
then, the subroutine it calls must be designated as lowercase:
o<subname> sub
o<subname> endsub
AND the file in which it is found must be named with lowercase:
subname.ngc.
(I, pugnaciously, still don't think the documentation makes that point as well as you just did.)
Please Log in or Create an account to join the conversation.
- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- "Named" file subroutine call fails; "Numbered" ok
Time to create page: 0.076 seconds