Failure to find Named Subroutines

More
9 months 3 weeks ago #341219 by roycegb
I have always had problems with named subroutines but lately I cannot get them to work at all.I get the following message;

LinuxCNC Error Near line 4 of/home/rpi-first-boot-wizard/linuxcnc/nc_files/Utility_G_Code/test.ngc:Failed to find sub 'Omyfile.ngc' before EOF

In this case I had a dead simple routine named 'test.ngc' that called a dead simple subroutine named 'my file.ngc'.

The location of the files and subroutines was called out in the .init file.

I have used named subroutines in the past.  I now use Raspberry Pi 4 and 5 with Axis 2.9.4 versions.

Any fool proof method for handling these subroutines would be appreciated.
I have a boat load of specializedsub routines lying dormant.

Please Log in to join the conversation.

More
9 months 3 weeks ago #341220 by tommylight


In this case I had a dead simple routine named 'test.ngc' that called a dead simple subroutine named 'my file.ngc'.
No idea if this is the issue, but easy to test so:
-no spaces in file names, this was an issue way back, not sure if it still is
-use a file name like: my_file.ngc

Please Log in to join the conversation.

More
9 months 3 weeks ago #341222 by MaHa
The name must always match

file:
myfile.ngc

in the subroutine:
o<myfile> sub
  some code
o<myfile> endsub

call the sub:
o<myfile> call
 

Please Log in to join the conversation.

More
9 months 2 weeks ago #341249 by roycegb
tommylight;
The space in the original post was a typo. my file.ngc, no spaces.

MaHa;
I tied identical names with and without the .ngc suffix everywhere with no luck.

The attachment shows the result with all data shown as suggested.

I am suspicious that the program seems to be looking for 'Omyfile'   instead of simply O  'myfile'.  Could it be a parsing problem?

Thanks,
Royce

Please Log in to join the conversation.

More
9 months 2 weeks ago #341250 by MaHa
The percent sign %  in the calling routine could cause that error. Capital letters for the naming in the routine, maybe too

Please Log in to join the conversation.

More
9 months 2 weeks ago #341253 by tommylight
Do those files need to be executable?

Please Log in to join the conversation.

More
9 months 2 weeks ago #341309 by roycegb
I'll try to make them executable.

I duplicated a set of code that worked in Axis 2.8.1 andi ran on it in 2.9.7.

'test.ngc'

%
G0 X1
o<myfile> call
M05
M30
%

'my file.ngc'

o<myfile> sub
g0 X10
o<myfile> endsub
M2

'%SYMBOLS AT BEGINNING AND END'
Near line 4 of /home/cnc/Desktop/test.ngc:
Failed to find sub 'Omyfile" before EOF

'NO % SYMBOLS'
Near line 4 of /home/cnc/Desltop/test.ngc:
EOF in file:/home/cnc/Desktop/test.ngc seeking o-word: o<myfiles from line: 3

The searched for file is completely different. Not sure what that signifies?

Please Log in to join the conversation.

More
9 months 2 weeks ago #341461 by roycegb
I didn't have the SUBROUTINE PATH located in the [RS274NGC] section of the .INI file. That allowed me to use my subroutines with slight modifications..

Please Log in to join the conversation.

Time to create page: 0.121 seconds
Powered by Kunena Forum