RobotStudio event

Optional parameters initialization

Options

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, ool 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.

Comments

  • Joan
    Options

    I've seen how to do it, I cannot initialize the values directly in the declaration, but I can not initialize them and use a dummy variable for each of them inside the function/procedure:

    PROC SetVel(num nC, num nH, num nV, ool b1)

    VAR bool bAux := FALSE;

    IF (Present b1) THEN

      bAux := b1;

    ENDIF

    ! now I can work with bAux, and it is always initialized at FALSE...

  • Jshelson
    Options
    Check this out

    PROC rSmartTacValueDisplay(num nNumber
            \INOUT robtarget EndX
            \INOUT robtarget EndY
            \INOUT robtarget EndZ)
      
                IF PRESENT(EndX) AND PRESENT(EndY) THEN

                    !
                ENDIF
       
    ENDPROC