RobotStudio event

array of workobjects

Options
Hello,
I cannot find any refference in the rapid manual for this so I am trying to find the answer here.
I have multiple workobjects that I would like to store in an array like this:

TASK PERS wobjdata wObj1:=[FALSE,TRUE,"",[[181.197,632.58,297.741],[0.999992,0.00251573,0.000730156,0.00299524]],[[0,0,0],[1,0,0,0]]];
TASK PERS wobjdata wObj2:=[FALSE,TRUE,"",[[181.197,632.58,297.741],[0.999992,0.00251573,0.000730156,0.00299524]],[[0,0,0],[1,0,0,0]]];
TASK PERS wobjdata wObj3:=[FALSE,TRUE,"",[[181.197,632.58,297.741],[0.999992,0.00251573,0.000730156,0.00299524]],[[0,0,0],[1,0,0,0]]];
...... and so son

PERS wobjdata arrayofObj{3}:=[wObj1,wObj2,wObj3,....]

I am getting syntax error that says: Expected num but found identifier.    I suppose I cannot do it this way. I know I can do it like this with robtargets so I thought that I can do it with work objects but I can't. Is there any way how to do it?

thanks for the help






Comments

  • soup
    soup ✭✭✭
    Options
    Array of strings and check out ArgName.
  • innebandy
    Options

    Putting identifiers in array is not allowed. You should keep data structure of wobjdata in a array as follows.

    TASK PERS wobjdata wobj_array{3}:=[[FALSE,TRUE,"",[[700,-500,570],[1,0,0,0]],[[0,0,0],[1,0,0,0]]],[FALSE,TRUE,"",[[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]],[FALSE,TRUE,"",[[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]]];

  • soup
    soup ✭✭✭
    Options
    Here's a previous post which might help.
  • sort
    Options
    I found that post here is how I did it and it's working.
        CONST STRING wobjArray{10}:=["productA","productB","productC".....];
        VAR wobjdata actualWobjTemp;
        PERS wobjdata actualWobj;
            .......
             GetDataVal wobjArray{i},actualWobjTemp;
             actualWobj:=actualWobjTemp;
             MoveJ p201,v1000,z50,tGripper\WObj:=actualWobj;

    Identifiers in array is  not allowed but with robtargets it is working

  • lemster68
    Options
    sort said:

    Identifiers in array is  not allowed but with robtargets it is working


    It does work, but if you really want to see something that will blow your mind, put robtarget names into a CONST array.  Then try to modpos one of the named positions.  It won't work, and won't tell you why.  It is actually a way one could lock down positions that you absolutely don't want to be modified.  You would have to comment out the array, modify positions, and then uncomment the array.
    Lee Justice