Forgot password?

Create an account!

Forum

« back

RhinoScript – How to access Sun data

Messages

Please log in to write a message.

  • 7. Hanno (Apr 02, 2013 09.46):

    Hi Martin,

    so you are in Grasshopper - good to know :-)
    There is a second way to retrieve the current Rhino Document:

    Rhino.RhinoDoc.ActiveDoc

    I guess that's the way to go then.

    Best

    Hanno

  • 6. martink (Apr 01, 2013 10.52):

    Hi Hanno,

    sorry, if this are stupid questions ...

    If I put your line into my script (in Grasshopper Python Script) I get the following error message:

    Runtime error (MissingMemberException): 'GrasshopperDocument' object has no attribute 'Lights'

    Thank you
    Martin

  • 5. Hanno (Apr 01, 2013 10.36):

    Hi Martin,

    the current document is accessible via the scriptcontext module as scriptcontext.doc. The sun settings are part of the Lights Table:

    sun = scriptcontext.doc.Lights.Sun

    Hope that helps!

    Hanno

  • 4. martink (Mar 31, 2013 11.33):

    Hi Hanno,
    after some hours of trial and (most of all) errors I come back with a further beginners question.

    I have started with a script in the Grasshopper Python Script Component. It looks like I can get the informations from the Rhino.Render.Sun class, but not from the active document. Am I rigth, that I have to connect to the aktive document? This is my code, which gives results but does not reflect the actual settinggs in the sun panel.

    import Rhino.Render.Sun

    sun = Rhino.Render.Sun()

    blnEnabled = sun.Enabled
    Latitude = sun.Latitude


    print "Sonne aktiv:" , blnEnabled
    print "Länge" , Latitude

    Many thanks for any hints
    Martin

  • 3. martink (Mar 30, 2013 11.05):

    Hi Hanno,

    thank you very much for clarification and advice. As I am just at the beginning this is absolutly helpful.

    Martin

  • 2. Hanno (Mar 30, 2013 10.52):

    Hi Martin,

    I'm afraid this is not possible with RhinoScript. RhinoScript offers only a subset of Rhino's functionality, centered more around modelling than rendering.

    If you are just starting, you could think about switching to RhinoPython. Here you have the same functionality as in Rhinoscript, but additionally you can seamlessly switch to the full RhinoCommon SDK, through which you can access sun settings (have a look at the Rhino.Render.Sun class).

    Hope that helps

    Hanno

  • 1. martink (Mar 29, 2013 18.02):

    Hello to this list.
    This is my first message and I hope not to rais any stupid questions here.
    I am just starting exploring Rhino Script and came to the following question. In Rhino 5 there is a Sun Panel where I can set the north orientation, Lat and Long. I would like to use this informations within my script. How can I access these data?
    Many thanks for any idea and sorry for my bad English
    Martin

Recommend

Why are these buttons gray?