Problems with ShadowTime/Time conversion

Problems with ShadowTime/Time conversion

Postby careca » Fri Apr 03, 2009 8:28 am

Hi everybody.

I just wrote my first (!) few lines in Ruby in order to make Sketchup help me with my Shade Analysis. This script basically creates a series of scenes with different time/date settings.

It's almost working the way I want to, the only thing I cannot figure out is the ShadowTime-issue and the conversion of the different time formats.

(My model location is in Japan).

If anybody is able to have a look at lines 50-54 in the attached file.
Help would be very much appreciated. :thumb:

Best wishes from Tokyo.
Martin
0

careca 
PluginStore Author
PluginStore Author
 

Re: Problems with ShadowTime/Time conversion

Postby TIG » Fri Apr 03, 2009 11:17 am

It was a bit complex for a first Ruby !!!

But well done - it was 99% fine... Never be afraid to ask for help - that's what we are here for...

I've attached a revised script:
Code: Select all
t = Time.local(2009, time_month, time_day, time_start, 0)
# did not figure hour the time conversion completely, and it is still not working properly
#new_t = t - (60 * 60 * my_offset)+(60*60*2)
###new_t = t - (60 * 60 * my_offset) - (60*60*3)
new_t = t ### TIG the time IS the time ???***
new_t = new_t + (60*60) if seasons[sss] == "Summer 6/21"
### this fixes summertime hour discrepency TIG
### it makes 5:00 to 21:00 hrs pages for three seasons - several are 'black' as it's night
### might be better to have different ranges for each season ?
for ss in 5...22
  #UI.messagebox ss
  si['ShadowTime'] = new_t
  new_t = new_t + (60*60)

  status = pages.add my_view_name.to_s + " - " + seasons[sss]+" - "+ss.to_s+":00"
end

The bit you had wrong*** was easy fixed - I've also added sometgig to sort out summer daylight saving time glitch that seems to affect the summer - pages and actual times were 1 hour wrong otherwise...

Keep on scripting...
0
TIG
User avatar
TIG 
Global Moderator
 

Re: Problems with ShadowTime/Time conversion

Postby careca » Mon Apr 06, 2009 1:40 am

Hi TIG.
Thanks for taking the time to look after my little script.

Looks like you accidentally for forgot to implement the time zone offset..

I enhanced the script further by:

1. including a question in the initial dialog box whether summertime should be included (we do not have summertime in japan...)

Code: Select all
# inpubox
questions = ["Enter Name", "Summertime"]
defaults = ["Shadow-Analysis", "no"]
list = ["", "no|yes"]
my_view_name_values = UI.inputbox questions, defaults, list, "Please adjust."
   
my_view_name = my_view_name_values[0]
summertime = my_view_name_values[1]


2. manually reset the TZOffset to +9, after the import from GE, it was set to +12...
Code: Select all
si['TZOffset'] = 9


3. include the Time offset & summertime offset

Code: Select all
#include the Time offset
new_t = t + (my_offset*60*60) ### TIG the time is the time ???

# summertime      
new_t = t + (60*60) + (my_offset*60*60) if seasons[sss] == "Summer 6/21"  && summetime == "yes"


The only remaining question is why the timezone setting was wrong after importing the location from GE....

revised script attached.
0

careca 
PluginStore Author
PluginStore Author
 

Suggestions for ShadowTime/Time conversion

Postby facer » Mon Apr 06, 2009 4:19 pm

Martin,
Thank you for the plugin it should evolve into a very useful tool.
Cheers
Ray

A few suggestions:
1. Could you give Southern Hemisphere users the option of reversing
your Winter, Summer etc. labels for the months.

2. An option to print out only the months and dates would assist in
cross referencing the scenes to town planning regulations.
For example "Sept 21 - 1500(3pm)" etc.

3. Could there be a selection for only the times required by the
authorities. Such as 0900 am, 1200 noon, and 1500 (3pm)

Notes:
I have integrated your shadows for set date and times with the SunTool to show the sun views. This results in a useful graphic.
0
User avatar
facer 
Premium Member
Premium Member
 

Re: Suggestions for ShadowTime/Time conversion

Postby careca » Tue Apr 07, 2009 12:34 am

Hi Ray.
Thanks for your comment.

When i started to write this script, it was just meant to make my current task easier.
After some time i noticed this might be useful for other people as well.
I will try to generalize it as much as possible once I find the time.


facer wrote:A few suggestions:
1. Could you give Southern Hemisphere users the option of reversing
your Winter, Summer etc. labels for the months.

2. An option to print out only the months and dates would assist in
cross referencing the scenes to town planning regulations.
For example "Sept 21 - 1500(3pm)" etc.


-> that sounds reasonable.

facer wrote:3. Could there be a selection for only the times required by the
authorities. Such as 0900 am, 1200 noon, and 1500 (3pm)


-> hmm, either you select certain hours in advance or delete unnecessary scenes afterward.

Please keep in mind the script is so far only working for Japan, as the offset is preset within the script. This needs to be changed. I also started writing an if-clause that dynamically only creates scenes for between sunrise and sunset hours.

Best wishes.
Martin
0

careca 
PluginStore Author
PluginStore Author
 

Re: Problems with ShadowTime/Time conversion

Postby jdagen » Mon Jan 14, 2013 8:32 am

I know this is a fairly old thread, but could someone explain the time zone offset? I get the need for an offset, is it based off of GMT? What constitutes positive and negative?
0

jdagen 
 

Re: Problems with ShadowTime/Time conversion

Postby tab1 » Fri Aug 09, 2019 9:44 pm

Hi Careca,

Thanks for the extension - looked great - but I'm having trouble with getting it off "summer" in the drop down so it will work with "winter" instead and with a bit different times. Also, how do we output the nice shaded shadows combination, let's say from 9AM thru 4PM on Dec 21, 2019 for our customer? Maybe I've installed it incorrectly? No instructions have shown up either. I'm on a Windows 10 with SU 18.
Thanks !

tab1
0

tab1 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: Darren Gilford and 7 guests

Visit our sponsors: