question

Pinakin K avatar image
0 Likes"
Pinakin K asked Jacob Gillespie edited

How to get the staytime for an object in 3d, in custom code?

I used the code:

Object Handover = token.FirstHandover;;
double staytime = getstat(Handover,"Staytime",STAT_STAYTIME,1);

if(staytime > 0.5)
{
	return 1;
}
else
{
	return 2;
}

The token.firsthandover, is the token label given the value of the object in 3d.

The value of Staytime i get is very big, even when the delay is 4 seconds.

Why is this happening?

Thanks in Advance!

FlexSim 18.1.1
custom codestaytime
staytime.png (11.0 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

·
Jacob Gillespie avatar image
0 Likes"
Jacob Gillespie answered Jacob Gillespie edited

Here is how to get the staytime of an object.

With dot syntax:

Handover.stats.staytime.value

With the getstat() command:

getstat(Handover, "Staytime", STAT_CURRENT)
5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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