getitemtype(current.inObjects[2]) doesn't work

getitemtype(current.inObjects[2]) doesn't work

thibaut_p3
Not applicable
3 Views
4 Replies
Message 1 of 5

getitemtype(current.inObjects[2]) doesn't work

thibaut_p3
Not applicable

[ FlexSim 18.0.2 ]

Hi all,

I have 2 sources connected to a combiner. I would like my combiner to set its item type to the same type of items from source 2.

For this, I set a trigger at entrance: set item type and color with a value getitemtype(current.inObjects[2]) but it doesn't work.

The final goal is to have each object set up a color similar to its input or one of its inputs. So even after combining items together, I can still follow from which type they belong to.

Thanks in advance,

Thibaut

0 Likes
Accepted solutions (1)
4 Views
4 Replies
Replies (4)
Message 2 of 5

joerg_vogel_HsH
Mentor
Mentor
current.inObjects[2] 

it isn't a reference to an item

From the Command Reference:

getitemtype(obj object) Deprecated, use labels
Description This command is deprecated. Use labels instead.
Message 3 of 5

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

Perhaps you can set the color in another trigger. That would be easier, because all items are already in the combiner. Then you can copy the color of the container to all other items.

The container item is containing the packed items.

for (int cnt = 1; cnt <= item.subnodes.length; cnt++ ) 
item.subnodes[cnt].as(Object).color = item.color;

same-color-items-combiner.fsm

Message 4 of 5

thibaut_p3
Not applicable

Thanks @Jörg Vogel ! I appreciate it 🙂

0 Likes
Message 5 of 5

Matthew_Gillespie
Autodesk
Autodesk

Item type has been deprecated for a couple version now. So unless you started building this model in 17.1 or earlier, getitemtype() won't return anything. Now all the pickoptions that reference Item Type are just adding a Type label to the item. To get its value you would just use item.Type.



Matthew Gillespie
FlexSim Software Developer