Face Sun Plug-in

90 views
Skip to first unread message

construsol

unread,
Apr 6, 2010, 2:24:41 PM4/6/10
to Google SketchUp Developers - SketchUp Ruby API
Hi.

As a follow up of my previous topic about Archeoastronomy and
Sketchup, I'm wondering if there is a Plug-in for "Face Sun". It would
work like the existing feature "Face Camera", but in this case the
selected plane would face directly straight to the sun in such a
manner that the sun rays fall perpendicular to that plane. Thanks in
advance for any info.

Dan Rathbun

unread,
Apr 7, 2010, 2:24:07 PM4/7/10
to Google SketchUp Developers - SketchUp Ruby API
Sketchup ShadowInfo settings use the Ruby standard class "Time", which
can only hold years starting 01 JAN 1970.

Your plugin would want to use the extended Ruby class "Date" that can
display dates back to 4712 BCE, so the backward range would be 6813
years (counting year 0.)
Sketchup would not use the Date class, so your plugin would need to
track it's own SUN object.

construsol

unread,
Apr 8, 2010, 4:11:50 AM4/8/10
to Google SketchUp Developers - SketchUp Ruby API
Hi Dan

The "Face Sun" plug-in was created here today:

http://forums.sketchucation.com/viewtopic.php?f=323&t=27499

I would like to know your comments of this plug-in in the context of
your mail about Ruby class "Date" and "Time". I have no programming
background but I'm interested about the years you mentioned, specially
because in Sketchup there is no way to feed it with years info, only
day, month, hour and minutes. Is the "Face Sun" plug-in limited to
years? Thanks for any info you can provide.

Dan Rathbun

unread,
Apr 8, 2010, 5:16:19 AM4/8/10
to Google SketchUp Developers - SketchUp Ruby API
The Sun position would be controlled by ShadowInfo class
http://code.google.com/apis/sketchup/docs/ourdoc/shadowinfo.html

#-- Ruby
new_time = Time.gm(1981,"jan",1,20,15,1)
model = Sketchup.active_model
shadowinfo = model.shadow_info
shadowinfo['ShadowTime']=new_time
#-- end Ruby

The Time.gm method parameters are:
(YEAR,month,day,hour,min,sec,usec)
The year is required, all others are optional and default to their
minimum values.
Time.gm creates a new time object based on UTC (GMT) time.
http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_c_time.html

Info on extended Date class:
http://www.ruby-doc.org/docs/ProgrammingRuby/html/lib_standard.html
Below class Complex, scroll down ...

Reply all
Reply to author
Forward
0 new messages