[Plugin] Face Sun

[Plugin] Face Sun

Postby thomthom » Wed Apr 07, 2010 6:53 pm

In response to: http://forums.sketchucation.com/viewtop ... 23&t=27477

  1. Make selection containing faces
  2. Plugins -> Face Sun

Positions all the faces in the selection to face the sun's current position.

No live update.


Update 1.1 (Jim Edition)
Thanks to Jim that modded the script so that connected geometry to the selected faces also rotates accordingly.

Download

0
Last edited by thomthom on Sat Jan 18, 2014 1:08 pm, edited 1 time in total.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Plugin] Face Sun (1.0.0) — 07 April 2010

Postby Dan Rathbun » Thu Apr 08, 2010 10:21 am

The astronomer who requested this, replied to the post at GG complaining (about Sketchup, not you ThomThom,) that's it's not easy to change the year in the Shadow info dialog. (Actually he thinks there's no way to change the year; he must have missed those left/right tick buttons.)
I replied, with this:

The Sun position would be controlled by ShadowInfo class
http://code.google.com/apis/sketchup/do ... winfo.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/Programmin ... _time.html

Info on extended Date class:
http://www.ruby-doc.org/docs/Programmin ... ndard.html
Below class Complex, scroll down ...
0
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author
     

    Re: [Plugin] Face Sun (1.0.0) — 07 April 2010

    Postby Dan Rathbun » Thu Apr 08, 2010 10:27 am

    So he has no knowledge on how to use the info I gave him, to write an Inputbox script for setting time, and I'm too busy with home repairs the rest of the week to help him out.

    I also have no idea if Sketchup would honor the Date class. The guy is obviously interested in ancient dates because he studies ancient architecture. I just don't know if Sketchup could handle going back 6723 years.
    0
      I'm not here much anymore. But a PM will fire email notifications.
      User avatar
      Dan Rathbun 
      PluginStore Author
      PluginStore Author
       

      Re: [Plugin] Face Sun (1.0.0) — 07 April 2010

      Postby thomthom » Thu Apr 08, 2010 10:32 am

      hmm..
      I don't have much time to work on this. Certainly not this week. And in general I'm atm busy with Vertex Edit.
      Just put something quickly together when I had a spare 5 mins. Will make it also orient connected geometry to the faces in an update next week. But I really can't promise anything more.

      If anyone else want to jump in on this then feel free. Use my code as a base if you want. (not much code really - very simple script.)
      0
      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund
      User avatar
      thomthom 
      PluginStore Author
      PluginStore Author
       

      Re: [Plugin] Face Sun (1.0.0) — 07 April 2010

      Postby thomthom » Thu Apr 08, 2010 2:24 pm

      Update - Thanks to Jim!
      0
      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund
      User avatar
      thomthom 
      PluginStore Author
      PluginStore Author
       

      Re: [Plugin] Face Sun (1.0.0) — 07 April 2010

      Postby construsol » Thu Apr 08, 2010 5:34 pm

      Dan, Thom:

      Dan, you are right, years can be inputed, just seen how to do it, and thanks for the links, altough I don't have the necessary knowledge I will read them and try to be familiar with Ruby at least with this script to see if I can make adaptations to it according to own needs. Thom and Jim, thanks for the uptdate.


      Dan Rathbun wrote:The astronomer who requested this, replied to the post at GG complaining (about Sketchup, not you ThomThom,) that's it's not easy to change the year in the Shadow info dialog. (Actually he thinks there's no way to change the year; he must have missed those left/right tick buttons.)
      I replied, with this:

      The Sun position would be controlled by ShadowInfo class
      http://code.google.com/apis/sketchup/do ... winfo.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/Programmin ... _time.html

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

      construsol 
       

      Re: [Plugin] Face Sun (1.1.0) — 08 April 2010

      Postby Ken » Thu Apr 08, 2010 9:49 pm

      This is a good plugin. Now here comes the however, would it be possible to make a selection, such as face "front", "top" or "Sun". This would make it a lot easier to take apart a model and align the faces for export to ACAD file.

      Jim, this would make it easier to use your "Make Orthographic Views" plugin.

      If not, thanks for the plugin.

      Ken
      0
      Fight like your the third monkey on Noah's Ark gangway.
      User avatar
      Ken 
      Premium Member
      Premium Member
       

      Re: [Plugin] Face Sun (1.1.0) — 08 April 2010

      Postby bau.arch » Fri May 13, 2011 10:12 pm

      Hi Thom,

      I've just stumbled upon this little plugin. I though it would be great as an "Always face sun" option for a component (similar to "Always face camera").

      It would be nice for rendering billboard people\trees with accurate shadows (creating a shadow "dummy" that always faces sun).

      Is there a way to make this happen?

      thnks,

      Assaf
      0

      bau.arch 
       

      Re: [Plugin] Face Sun (1.1.0) — 08 April 2010

      Postby Gultekinmg » Thu Oct 13, 2011 2:08 pm

      I want sun right inside my house at moon. How about that.
      COuld you also position sun in a room as light source?
      0

      Gultekinmg 
       

      SketchUcation One-Liner Adverts

      by Ad Machine » 5 minutes ago



      Ad Machine 
      Robot
       



       

      Return to Plugins

      Who is online

      Users browsing this forum: Google Bot, konradt and 10 guests

      Visit our sponsors: