Grasshopper

algorithmic modeling for Rhino

Hi All,

I've been messing around with the Sun class in the Render Namespace in a VB component, and I've come to realize that I first have to run the "sun" command in Rhino to open the sun dialog box for the class to be responsive in gh.

When I call the these lines of code below they return a zero for altitude and azimuth. After I run the "sun" command I get the appropriate values I'm anticipating.

Dim dt As datetime = datetime.now

Dim lt As Rhino.DocObjects.Tables.LightTable = rhinodocument.Lights 
lt.Sun.SetPosition(dt, latitude, longitude) 
lt.Sun.Enabled = True 
_Alt = lt.Sun.Altitude

_Az=lt.Sun.Azimuth

_SunVect = lt.Sun.Vector 

Is there a way to get the sun class to return values without having to run the "sun" command first?

Thanks,

Views: 236

Replies to This Discussion

if you just want to get the sun vector:  Rhino.Render.Sun.SunDirection(latitude, longitude, dt)

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service