Is there a way to tell if a value was passed on the subroutine CALL statement?

More
18 Jul 2023 17:44 #275750 by KenA
Similar to the earlier thread...
In Fanuc you can tell if a parameter was passed on the call line by checking if value = #0 in the subroutine

But it looks like LinuxCNC just passes all the existing #1...#32 variables from the parent routing to the subroutine, for any not specified on the command line.

So as not to break existing macros, is there a way to submit an enhancement request to add a ?global? variable (e.g. <_param_count> that supplies how many parameters were on the command line?  I see there are parameters to tell the parent routine if there is a return value (#<_value>, #<_value_returned>)

 

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

More
25 Jul 2023 11:55 #276217 by andypugh
If enabled in the INI with the option
OWORD_NARGS = 1
Then you can read the parameter #<n_args>

linuxcnc.org/docs/html/config/ini-config...l#gcode:ini-features

I don't know why it defaults to 0. I might change that.

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

Time to create page: 0.154 seconds
Powered by Kunena Forum