sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Setting the Date and Time for a Shadows study

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 4 Posters 608 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      KevinKarney
      last edited by

      I am just starting on Ruby scripting, so there is probably an obvious answer to this...
      I need to be able to change the date and time from within a script and can find nothing in the documentation of how to do this.
      Any help would be most appreciated

      Best Regards
      Kevin Karney

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        Welcome!, there lots of us just learning around here right now. Its a great time to learn ruby!

        This shows the shadow info for the model.
        model = Sketchup.active_model model.shadow_info.to_a.join(', ')

        Here is an example of how to adjust the information:
        model = Sketchup.active_model shadowinfo = model.shadow_info value = shadowinfo["City"] UI.messagebox value value = shadowinfo["City"]="Denver, CO" UI.messagebox value

        And here is a link to the ShadowInfo class in the API:

        http://code.google.com/apis/sketchup/docs/ourdoc/shadowinfo.html

        the []= method is the one that shows how to set the values in the shadowinfo hash. Hope that helps, keep asking questions,

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          Welcome Kevin,

          The time and date settings, among others, are stored in the ShadowInfo class.

          It acts like an attribute array, so you get and set the values by name;

          
          shadow_info = Sketchup.active_model.shadow_info
          time = shadow_info["ShadowTime"]
          shadow_info["Longitude"] = 105.2830
          
          

          F u l l M E R ! (beat me to it.)

          Hi

          1 Reply Last reply Reply Quote 0
          • M Offline
            Matt666
            last edited by

            Just one thing: To know all parameters of a shadow_info entity, you can use .keys
            Exemple:

            Sketchup.active_model.shadow_info.keys
            

            will returns

            ["City", "Country", "Dark", "DayOfYear", "DaylightSavings", "DisplayNorth", "DisplayOnAllFaces", "DisplayOnGroundPlane", "DisplayShadows", "EdgesCastShadows", "Latitude", "Light", "Longitude", "NorthAngle", "ShadowTime", "ShadowTime_time_t", "SunDirection", "SunRise", "SunRise_time_t", "SunSet", "SunSet_time_t", "TZOffset", "UseSunForAllShading"]
            

            If you want to know one of these parameters, just do like that:

            Sketchup.active_model.shadow_info["City"]
            

            😉

            Frenglish at its best !
            My scripts

            1 Reply Last reply Reply Quote 0
            • K Offline
              KevinKarney
              last edited by

              Chris, Mat, Jim
              Many thanks - each of your responses added that extra bit to my knowledge. I think I have all I need for the next step of my journey. I am trying to build a virtual sundial correct for any Latitude and Longitude - which may seem a bit of a strange task. But Stetchup has rather a good model of the Earth's movement around the Sun. It correctly distinguishes between solar time - as seen on a sundial - from civil time - as read from your watch. So, with its ability to cast shadows correctly, a sundial simulator should not be too difficult.

              I'll keep you posted !

              Best Regards
              Kevin Karney

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement