Syntax for argument with '|' seperator
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.
I want the independence of the data type for calling SetValue.
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.
I hope someone can help me.
Thanks in advance!
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<b>|</b>dnum Dvalue) .... ENDPROC
I want the independence of the data type for calling SetValue.
VAR num Value; VAR dnum Dvalue; SetValue Value;<br>SetValue Dvalue;<br>
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!
0
Comments
-
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.—Maxim RiabichevPC Software Support Engineer0 -
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?
0 -
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.0
-
Hello,
Okay I'll have a talk with my collegues tomorrow.—Maxim RiabichevPC Software Support Engineer0 -
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).
—Maxim RiabichevPC Software Support Engineer0 -
Hello,Glad to hear it.Thanks for everything.Kind regards0
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 316 IRC5
- 61 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 798 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings