robotm
August 7, 2018, 12:33pm
1
Hello,
for a procedure I need the possibility to combine two arguments with a OR character.
With optional arguments it works fine, but I don’t wanna use optional arguments.
The following code is not accepted.
PROC SetValue(num Value**|**dnum Dvalue)
....
ENDPROC
I want the independence of the data type for calling SetValue.
VAR num Value;
VAR dnum Dvalue;
SetValue Value;
SetValue Dvalue;
I found a code example in the manuel for the procedure SetGo.
This is the syntax from the robotware manuel “technical reference manual - RAPID Instructions, Functions and Data types” on page 688.
SetGO
[ '\' SDelay ':=' < expression (IN) of num > ',' ]
[ Signal ':=' ] < variable (VAR) of signalgo > ','
[ Value ':=' ] < expression (IN) of num >
| [ Dvalue' :=' ] < expression (IN) of dnum > ';'
I hope someone can help me.
Thanks in advance!
Maxim
August 7, 2018, 1:05pm
2
Hello,
We’ve looked into this and because RAPID does not support overload you’ll have to ‘normalize’ the variable before you call the function. With normalize I mean convert to either num or dnum.
Consult the RAPID manual on how to do the conversion.
soup
August 7, 2018, 1:23pm
3
Interesting question! So, what kind of magic does the SetGO function have behind the scenes that it’s able to do the num or dnum without conversion?
robotm
August 7, 2018, 1:40pm
4
Hello Maxim Riabichev,
thank you for your response!
I know the conversion function, but from a programmer’s point of view it would be fantastic if two non-optional arguments could be combine with “or”.
The SetGo command illustrates the advantages!
I think it would be great if this possibility would be added in a future robotware update.
Maxim
August 7, 2018, 1:53pm
5
Hello,
Okay I’ll have a talk with my collegues tomorrow.
Maxim
August 8, 2018, 6:18am
6
Hello,
So we’ve spoken about this matter and we’ve reached the conclusion that the best would be if RAPID would support Overload, like C# does for example.
I will move this thread to the UpFeed section (as a suggestion for future addition to RAPID).
robotm
August 8, 2018, 8:58am
7
Hello,
Glad to hear it.
Thanks for everything.
Kind regards