- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- Is there a way to tell if a value was passed on the subroutine CALL statement?
Is there a way to tell if a value was passed on the subroutine CALL statement?
- KenA
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
18 Jul 2023 17:44 #275750
by KenA
Is there a way to tell if a value was passed on the subroutine CALL statement? was created 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>)
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.
- andypugh
-
- Offline
- Moderator
-
Less
More
- Posts: 23212
- Thank you received: 4892
25 Jul 2023 11:55 #276217
by andypugh
Replied by andypugh on topic Is there a way to tell if a value was passed on the subroutine CALL statement?
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.
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.
- GCode and Part Programs
- O Codes (subroutines) and NGCGUI
- Is there a way to tell if a value was passed on the subroutine CALL statement?
Time to create page: 0.140 seconds