How to make a robtarget position dependent from a variable

I have about 10 robtarget positions whose x and y coordinates are all dependent from a which is an input variable so it cannot be constant. My robtarget positions look something like this:

VAR robtarget Target_10:=[[(10a), (8a), 0],…];
VAR robtarget Target_20:=[[(18a), (10a), 0],…];

But the problem is that the values in robtarget positions have to be constant.
So is it somehow possible to make my positions dependent from a?

You can do the following after the variable declarations:

Target_10.trans := [10*a, 8*a, 0];

You can also use functions if you don’t want the robtarget to be changed by operators.

    CONST robtarget a:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];

    FUNC robtarget Target_10()
        VAR robtarget ret;
        ret := a;
        ret.trans:= [10*a.trans.x, 8*a.trans.y, 0];
        RETURN ret;
    ENDFUNC
    
    PROC main()
        MoveL a,v1000,z50,tool0\WObj:=wobj0;
        MoveL Target_10(),v1000,z50,tool0\WObj:=wobj0;
    ENDPROC

Thanks, that’s really helpful! I’m gonna try it out later

@Tompanhuhu If you don’t want a position to be modified by anyone at all, do this:

         CONST robtarget myRobtarget:=[[471.96,165.24,337.40],[0.147458,0.375124,0.905628,0.131821],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget myRobtarget10:=[[360.69,346.35,337.40],[0.116071,0.174066,0.964666,0.16015],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget myRobtarget20:=[[328.12,315.08,266.77],[0.0483949,0.176969,0.980755,0.0667735],[0,0,0,0],[9E+9,9E+9,9E+9,9E+9,9E+9,9E+9]];
CONST robtarget pLockDown{3}:=[myRobtarget,myRobtarget10,myRobtarget20];

The controller will report a position modify error, without a clue as to why.