Optional parameters initialization

  • Hello all,


    I'd like to know how to assign a predefined value to an optional parameter, I've tried to use this syntax, but it doesn't work:


    PROC SetVel(num nC, num nH, num nV, \bool b1 := TRUE)


    It is very important for me to be able to know that the optional value will always be one determined value if it is not directly specified by the user in the procedure call.



    Thank you in advance for your time and help.

  • ANZEIGE
  • Hello Joan,


    unfortunately it is not possible to initialize optional parameters in RAPID on declaration level.
    Anyway I think this would be useless because (in contrast to some other laguages) from inside the routine
    the parameter is simply NOT present when called without passing an appropriate argument.
    So you can't use it at all if not present (Runtime error when accessing the param)


    You can work around this with a second variable:


    hth
    addi

Hilfe und Support für ABB Roboter Programmierung, Konfiguration, Inbetriebnahme finden Sie hier im ABB Roboter Forum. ABB Rapid Programmierung ist einfach, die Roboterforum Community hilft sehr gerne.

Erstelle ein Benutzerkonto oder melde dich an um zu kommentieren

Du musst ein Benutzerkonto haben um einen Kommentar hinterlassen zu können

Benutzerkonto erstellen
Neues Benutzerkonto für unsere Community erstellen. Geht einfach!
Neues Benutzerkonto erstellen
Anmelden
Du hast bereits ein Benutzerkonto? Melde dich hier an.
Jetzt anmelden