question

Karthikeyan B avatar image
0 Likes"
Karthikeyan B asked Karthikeyan B commented

Display Simulation Time as Text or bill board in 3D space

Hello

I was wondering if there is a way to just get the real runtime clock to display as a text in the 3D model for easy viewing.

I am trying to add the simualtion timer next to some 3D objects to see how it reacts based on time.

I was able to customize the clock as shown in the picture but it counts in minutes and seconds.

I have seen this example shown below in the Q and A forum but was not able to use that in the code.

Can some one show me an example ?

getmodelunit(CURRENT_TIME) //Returns FS_DATETIME
time() //Returns model time
convert(time(), MODEL_TIME, DATETIME_STR) //Will print out date time based upon the date/time format string, for example 8:00:00 AM Fri 24 Jun 2016
FlexSim 19.1.0
display time in 3d objects
time.png (98.2 KiB)
· 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.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

What format do you want it to display in? Did you try the Use Default Format option?

0 Likes 0 ·
Karthikeyan B avatar image Karthikeyan B Matthew Gillespie ♦♦ commented ·

Hello Matt , I am trying to display it in seconds.

2400000.00 seconds ~ 66 Hrs

SSSSSS.SS

0 Likes 0 ·

1 Answer

Matthew Gillespie avatar image
2 Likes"
Matthew Gillespie answered Karthikeyan B commented

In the Text object's Display Text field put this line of code:

textnode.value = string.fromNum(getmodelunit(CURRENT_SECOND), 2);

Or if you just want it to display in whatever units the model is using you could do

textnode.value = string.fromNum(Model.time, 2);

See this example model.

timedisplay.fsm


timedisplay.fsm (102.6 KiB)
· 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.

Karthikeyan B avatar image Karthikeyan B commented ·

Brilliant , Thank you @Matthew Gillespie

0 Likes 0 ·