Call external subroutine not working in recent versions of LCNC

More
17 Mar 2018 06:48 - 17 Mar 2018 06:49 #107459 by curtisa
Hello chaps,

I was recently tasked to do a small job milling an ellipse into some plastic, and figured I'd use an ellispe subroutine I'd found around these parts some time back to simplify the coding entry. I had previously used this subroutine in LCNC 2.7.4 without a hitch, invoking the 'o<ellipse> call [p1x] [p1y]...' from a bare bones ngc file.

When I tried running the same code today in LCNC 2.7.12 and calling the ellipse function I got an error in Axis claiming 'EOF in file: filename calling the subroutine.ngc seeking o-word: o<ellipse> from line 5'.

I've tried simplifying things to chase down this error by creating two test codes. The first is the base ngc from which I'm calling the sub (named Call_test.ngc):
G21 G17 G40 G49 G54 G64 P0.005 G80 G90 G94
G0 Z50
	o<test> call
M2

And the called sub itself (named test.ngc):
o<test> sub
	(MSG, Hello)
o<test> endsub
M2

But the error still persists:


I have confirmed that my PROGRAM_PATH is pointing to the default nc_files directory and my 'test.ngc' subroutine is located in this folder. I'm assuming the error suggests that the subroutine has been correctly called and found, but it's bailing out partway through.

Has something changed in the way subroutine calls are handled between 2.7.4 and 2.7.12 that isn't reflected in the online documentation, or am I missing something else obvious?
Attachments:
Last edit: 17 Mar 2018 06:49 by curtisa.

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

More
18 Mar 2018 15:13 #107494 by Hawkeye
Hello,

could you check whether the files are formatted in UNIX style and not in DOS style?

Regards,
BEN

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

More
19 Mar 2018 05:35 #107534 by curtisa
Hi Ben,

I can confirm that both 'Call_test.ngc' and 'test.ngc' are being saved as UNIX format within gedit.

The subroutine 'test.ngc' will actually load into Axis if opened directly from the File menu (as will the original 'ellipse.ngc' I wanted to use to begin with); they just obviously won't do anything if run directly from Axis.

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

More
21 Mar 2018 13:03 #107660 by andypugh
I think you might need to set SUBROUTINE_PATH
linuxcnc.org/docs/2.7/html/config/ini-co...ml#_rs274ngc_section

There is a meaningful entry [DISPLAY]PROGRAM_PREFIX but no PROGRAM_PATH as far as I am aware.

But it is odd if things used to work and don't now, because I am pretty sure that nothing has changed there.

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

More
21 Mar 2018 20:11 #107693 by curtisa
Hi Andy,

No joy. Specifying SUBROUTINE_PATH as the location of the 'test.ngc' still gives the same error.

And apologies on my part - I mentioned in my first post about PROGRAM_PATH being specified as the location of my default nc_files folder, but actually meant PROGRAM_PREFIX.

Are you able to run a copy of my two codes I posted at the top of this thread to check that it does do the right thing for you?

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

More
21 Mar 2018 20:58 #107697 by curtisa
As a quick test I've installed a copy of the Ubuntu 10.04 LiveCD onto a virtual machine (LCNC 2.5.0) and can confirm that the above subroutine call works, so it must be something to do with the install on my actual milling PC that's different. I'll try getting the virtual machine upgraded to 2.7.12 to see if it suddenly stops working.

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

More
22 Mar 2018 04:45 #107708 by curtisa
I've just had one of those 'Duh' moments. I now realise that when I upgraded to 2.7.12, I also installed a fresh version of Ubuntu 10.04 on the milling PC. I just copied over the old stepconf config between the two installs of Ubuntu and had assumed nothing had changed between the two. On closer inspection I now see that I had set the username of the fresh install to 'cnc' whereas the old install was 'andrew'. The copied stepconf obviously had the original PROGRAM_PREFIX pointing to /home/andrew/linuxcnc/nc_files instead of what should've been /home/cnc/linuxcnc/nc_files.

As you were. :blush:

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

More
22 Mar 2018 19:28 #107733 by andypugh
Glad you solved it. I just came back here to copy and paste your files into a VM here to start testing.

Just in time. :-)

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

More
14 May 2022 17:41 #242964 by klamos
Wie kann ich das überprüfen?

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

Time to create page: 0.240 seconds
Powered by Kunena Forum