|
|||||||
| FAQ | Downloads | Calendar | Search | Mark Forums Read | vBExperience | Register |
| Tips and Tricks Share helpful modeling ideas |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
This can be accomplished with the use of a VisualTool object. Simply drag a VisualTool into your model and set it display text. Under "Text Display", choose "Display Time". The code inside gives good ideas about how to display on-screen texts.
If you want to compute the week and day using code, you can do following: Code:
double startTime = 0; int week = (time()-startTime)/7/24/3600; int day = (time()-startTime-7*24*3600*week)/24/3600; Code:
treenode current = ownerobject(c);
treenode textnode = parnode(1);
/**Display Time. Format - Week w, Day d*/
double startTime = 0;
int week = (time()-startTime)/7/24/3600;
int day = (time()-startTime-7*24*3600*week)/24/3600;
string timetext =
concat(
"Week ",
numtostring(week,0,0),", Day ",
numtostring(day,0,0)
);
setnodestr(textnode, timetext);
|
| The Following 2 Users Say Thank You to Regan Blackett For This Useful Post: | ||
Brandon Peterson (10-24-2008), Pablo Concha (08-11-2008) | ||
|
#2
|
|||
|
|||
|
Regan:
This did not work. When I started running the model, the date did not change from "Week 0, Day 0". |
|
#3
|
|||
|
|||
|
It does work for me, code assumes you're working on seconds, so it may take a while to change days/weeks if you're running the model slow (86400 time units for each day).. you can change the 3600 on the model for 60 to work in minutes... or 1 in hours, etc...
regards, Pablo Concha E. |
| The Following User Says Thank You to Pablo Concha For This Useful Post: | ||
Dan Cremer (08-19-2008) | ||
|
#4
|
|||
|
|||
|
I meant to thank you sooner for your reply.
|
|
#5
|
|||
|
|||
|
How about if I want to display the Day of the week - ie: Sunday, Monday, etc.?
|
|
#6
|
|||
|
|||
|
Quote:
I think this works... (working on minutes).... Code:
treenode current = ownerobject(c);
treenode textnode = parnode(1);
/**Display Time. Format - Week w, Day d*/
double startTime = 0;
int week = (time()-startTime)/7/24/60;
int day = (time()-startTime-7*24*60*week)/24/60;
string daystr;
switch(day)
{
case 0: daystr = "Monday";break;
case 1: daystr = "Tuesday";break;
case 2: daystr = "Wednesday";break;
case 3: daystr = "Thursday";break;
case 4: daystr = "Friday";break;
case 5: daystr = "Saturday";break;
case 6: daystr = "Sunday";break;
}
string timetext =
concat(
"Week ",
numtostring(week,0,0),", ",
daystr
);
setnodestr(textnode, timetext);
Pablo Concha E. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|