question

Afonso Teberga avatar image
2 Likes"
Afonso Teberga asked Jason Lightfoot edited

How to return whether the slot item is virtual

Hi,

I'm trying to access the "isVirtual" property of a Storage.Slot.Item using a script like this:

Storage.Slot.Item item = Storage.system.findItem("");
return item.isVirtual;

However, the command returns the following error.

error.jpg

What is the correct way to do this? Is my synthax correct?

Thanks a lot.

isVirtual model.fsm

FlexSim 21.1.5
storage system
error.jpg (197.4 KiB)
isvirtual-model.fsm (37.5 KiB)
5 |100000

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

1 Answer

Jordan Johnson avatar image
2 Likes"
Jordan Johnson answered Jason Lightfoot edited

This looks like a FlexScript bug. Unfortunately, I don't know of a workaround. I have added it to the dev list, though.

It may help you to know, however, that if you are virtualizing items, they are all virtualized. They are only unvirtualized if something accesses the "item" property on the slot item:

slotItem.item.assignedSlot = ...;

I don't think items every become unvirtualized unless that happens.

· 4
5 |100000

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

Afonso Teberga avatar image Afonso Teberga commented ·
Thanks, Jordan!
0 Likes 0 ·
CSN avatar image CSN commented ·

Hi Jordan, we also encountered the same problem, will it be fixed in the next version?thanks!


0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ CSN commented ·

I can increase the priority of this issue, but I can't guarantee that it will be fixed in the next bug fix.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ CSN commented ·

In the meantime you can test if the object stored in the value of the Storage.Slot.Item exists. Here's an example:

clearconsole();
Array slotdotitems=Storage.system.queryItems("WHERE 1");
for (int n=1;n<=slotdotitems.length;n++){
if (objectexists(slotdotitems[n].value))
print (nodetopath(ownerobject(slotdotitems[n].value),1)+" is NOT Virtualized");
else
print (nodetopath(slotdotitems[n],1)+"  IS Virtualized");
}

In the model attached run the simulation forward and then execute the script. The one box is correctly identified as non-virtual.

TestForIsVirtual.fsm

0 Likes 0 ·