question

Thibaut avatar image
0 Likes"
Thibaut asked Matthew Gillespie commented

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

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

FlexSim 18.0.2
itemtypegetitemtype
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image Joerg Vogel commented ·
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.
2 Likes 2 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

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.

1 Like 1 ·

1 Answer

Joerg Vogel avatar image
2 Likes"
Joerg Vogel answered Thibaut edited

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


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Thibaut avatar image Thibaut commented ·

Thanks @Jörg Vogel ! I appreciate it :)

0 Likes 0 ·