Cuneyt Ozdas Forum
Cuneyt Ozdas Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 English - Software Support
 CounterText (Eng)
 CounterText for shadow impact studies
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Geoff
Starting Member

4 Posts

Posted - 20/08/2009 :  16:19:36  Show Profile
Like many architectural offices, we're creating shadow impact study animations using 3ds Max. With the help of this thread, http://area.autodesk.com/forum/autodesk-3ds-max/3ds-max-through-2008/daylights-date-and-time-info-stamped-on-rendering/page-last/ I managed to wire the mr sun's Solar_Time expression to the CounterText object, and by dividing (SolarTime)/3600 could animate the time. By formatting the CounterText's text with %0.2f the time displays as 12.5 which I would like to display as 12:30, thus HH:MM . I don't have a clue how to do it.

I was hoping I could get lucky, and just paste this script from the MAXScript help manual into the expression field:

fn TimeFromSolarTime dlSystem =
(
local solar_time = dlSystem.controller.solar_time.controller.value
local hrs = int solar_time -- full hours in the solar_time value
local min = int((solar_time-hrs)*60.0) -- full minutes in the difference between the full time and the full hours
local sec = int((solar_time-hrs-min/60.0)*3600 + 0.5) -- full seconds in the rest of the value
#(hrs,min,sec) -- return the result as a 3 elements array
)

TimeFromSolarTime $Daylight01

It doesn't work though, it returns a MAXScript Wire Controller Exception error --Unable to convert: #(12, 30, 2) to type: Float. I don't have any clue what that means, I'm just shooting in the dark here.

Does anyone out there know how to make this work? I know there are a lot of architects out there who would love to be able to have a time stamp in their animations with the HH:MM format.

Thanks,

Geoff

Admin
Forum Admin

Turkey
649 Posts

Posted - 21/08/2009 :  00:29:36  Show Profile  Visit Admin's Homepage
Hi,

Yeah CounterText accepts only a single floating point value. What you can do is to create 3 different CounterText objects (with %02f format) and write different script controllers for them (one returning hrs, one returning min and one returning with sec).

/Cuneyt
Go to Top of Page

Geoff
Starting Member

4 Posts

Posted - 21/08/2009 :  10:13:30  Show Profile
Well far out! And thanks for the reply. I tried creating two countertext objects, one for hours and one for minutes, but must have done something wrong because I couldn't get it to work. I'll give it another try.
Go to Top of Page

Geoff
Starting Member

4 Posts

Posted - 21/08/2009 :  14:36:05  Show Profile
Through a process of random typing and clicking and sheer blind luck I managed to get this working and it is perfect. for those out there who would like to know one way to do this here's how: Place two CounterText objects in the file, one for hours and one for minutes. Wire the User Count of each of them to the mr Sun's Solar Time. Here's how: Right click CounterText object > Wire Parameters > Modified Object > Counter Text (Object) > User Count, then select your Daylight System's [Daylight01] Sun02 Object (mrSun) > Solar Time. This opens the Parameter Wiring dialog. Wire it with the <--- button, and replace the Expression for Counter Text which reads Solar_Time with this script from the MAXScript Help:

fn TimeFromSolarTime dlSystem =
(
local solar_time = dlSystem.controller.solar_time.controller.value
local hrs = int solar_time -- full hours in the solar_time value
local min = int((solar_time-hrs)*60.0) -- full minutes in the difference between the full time and the full hours
local sec = int((solar_time-hrs-min/60.0)*3600 + 0.5) -- full seconds in the rest of the value
#(hrs,min,sec) -- return the result as a 3 elements array
)

TimeFromSolarTime $Daylight01

Because CounterText only accepts a single floating point value, you need to return the result as a single value, rather than a 3 elements array. So replace the # (hrs,min,sec) line with hrs for your hours CounterText object, and min for your minutes CounterText object.

For the formatting of the CounterText text, use this for hours: %02.0f: and this for minutes: %02.0f The 2 is the width field, defining the number of digits before the decimal point. The 0 before the 2 pads the value up to the width with zeros. The .0 is the precision field, or the number of digits behind the decimal point. If set to 0 (or left empty, only a . ) no significant digits and no decimal point are displayed. The result is a perfect digital clock, reading out hours and minutes like this: 06:15 12:22 23:00

I've got a good example file (3ds Max Design 2010) if anyone's interested.
Go to Top of Page

harima
Starting Member

Switzerland
1 Posts

Posted - 15/12/2009 :  15:45:59  Show Profile
hi

i am interested in your 3ds max design 2010 file, because i have right now the same problem. and i am not good enough in maxscript. can you send me this example? thanks a lot


quote:
Originally posted by Geoff

Through a process of random typing and clicking and sheer blind luck I managed to get this working and it is perfect. for those out there who would like to know one way to do this here's how: Place two CounterText objects in the file, one for hours and one for minutes. Wire the User Count of each of them to the mr Sun's Solar Time. Here's how: Right click CounterText object > Wire Parameters > Modified Object > Counter Text (Object) > User Count, then select your Daylight System's [Daylight01] Sun02 Object (mrSun) > Solar Time. This opens the Parameter Wiring dialog. Wire it with the <--- button, and replace the Expression for Counter Text which reads Solar_Time with this script from the MAXScript Help:

fn TimeFromSolarTime dlSystem =
(
local solar_time = dlSystem.controller.solar_time.controller.value
local hrs = int solar_time -- full hours in the solar_time value
local min = int((solar_time-hrs)*60.0) -- full minutes in the difference between the full time and the full hours
local sec = int((solar_time-hrs-min/60.0)*3600 + 0.5) -- full seconds in the rest of the value
#(hrs,min,sec) -- return the result as a 3 elements array
)

TimeFromSolarTime $Daylight01

Because CounterText only accepts a single floating point value, you need to return the result as a single value, rather than a 3 elements array. So replace the # (hrs,min,sec) line with hrs for your hours CounterText object, and min for your minutes CounterText object.

For the formatting of the CounterText text, use this for hours: %02.0f: and this for minutes: %02.0f The 2 is the width field, defining the number of digits before the decimal point. The 0 before the 2 pads the value up to the width with zeros. The .0 is the precision field, or the number of digits behind the decimal point. If set to 0 (or left empty, only a . ) no significant digits and no decimal point are displayed. The result is a perfect digital clock, reading out hours and minutes like this: 06:15 12:22 23:00

I've got a good example file (3ds Max Design 2010) if anyone's interested.

Go to Top of Page

Geoff
Starting Member

4 Posts

Posted - 30/11/2010 :  10:23:23  Show Profile
Hi Hari,

Sure, no problem. I've uploaded the file, zipped, to http://wtrns.fr/4vQNt15l1LcEIg. You should be able to download it using this link. Hopefully you'll find it useful as an example. I see that for some odd reason I set the length of the animation to 24 hours, with one frame per second. You'll most likely need to change that. The file's system unit is mm, which I no longer use, you'll probably need to change that as well. But the stuff in the file's pretty cool for reverse engineering if nothing else.

Good luck with it!

Geoff

quote:
Originally posted by Geoff

Like many architectural offices, we're creating shadow impact study animations using 3ds Max. With the help of this thread, http://area.autodesk.com/forum/autodesk-3ds-max/3ds-max-through-2008/daylights-date-and-time-info-stamped-on-rendering/page-last/ I managed to wire the mr sun's Solar_Time expression to the CounterText object, and by dividing (SolarTime)/3600 could animate the time. By formatting the CounterText's text with %0.2f the time displays as 12.5 which I would like to display as 12:30, thus HH:MM . I don't have a clue how to do it.

I was hoping I could get lucky, and just paste this script from the MAXScript help manual into the expression field:

fn TimeFromSolarTime dlSystem =
(
local solar_time = dlSystem.controller.solar_time.controller.value
local hrs = int solar_time -- full hours in the solar_time value
local min = int((solar_time-hrs)*60.0) -- full minutes in the difference between the full time and the full hours
local sec = int((solar_time-hrs-min/60.0)*3600 + 0.5) -- full seconds in the rest of the value
#(hrs,min,sec) -- return the result as a 3 elements array
)

TimeFromSolarTime $Daylight01

It doesn't work though, it returns a MAXScript Wire Controller Exception error --Unable to convert: #(12, 30, 2) to type: Float. I don't have any clue what that means, I'm just shooting in the dark here.

Does anyone out there know how to make this work? I know there are a lot of architects out there who would love to be able to have a time stamp in their animations with the HH:MM format.

Thanks,

Geoff

Go to Top of Page

RobertH
Starting Member

1 Posts

Posted - 14/03/2013 :  11:36:08  Show Profile
Yeah right, I can see it only accepts single value.





-
Custom Construction Essays | All good writing is swimming under water and holding your breath. --F. Scott Fitzgerald
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
Cuneyt Ozdas Forum © 2000 - 2003 Cuneyt Ozdas Go To Top Of Page
This page was generated in 0.11 seconds. Snitz Forums 2000