Setting scriptcontext.doc to Rhino Document Breaks radiationAnalysis

Hi @mostapha,

It’s been a while since I’ve been Ladybugging, good to be back :slight_smile:

Anywho, I’m pretty sure I’ve tracked down a bug that I couldn’t find any precedence for on the board:

When running the radiationAnalysis component, any GHPython component (including ones in other Grasshopper definitions within the same Rhino session) that sets scriptcontext.doc to Rhino.RhinoDoc.ActiveDoc seems to break the Ladybug dataflow, resulting in this message from radiationAnalysis (i.e. selectedSkyMtx failed to collect data! Use selectSkyMtx component to generate the selectedSkyMtx):

I’ve reproduced this behaviour on a number or working definitions (i.e. open definition, run it to verify it’s working, paste in GHPython component setting scriptcontext.doc, recompute definition to verify breakage).

I’m running a bunch of stuff both upstream and downstream that interfaces with the Rhino document, so this is a bit of a spanner in the works. Perhaps you have an idea of what might be causing this, that I can solve as is (i.e. by messing with the LadyBug GHPython code)?

Cheers and best,

Anders

Edit: Also, is it better to report things like on the github repo?

Hi @AndersHoldenDeleuran,

Nice catch. @mostapha is travelling to conduct workshops. So until he has a chance to look at this, doing the following should work.

  1. After you open rhino and then open the GH for the first time, put the python component you are showing in the attached image. this is the component in which you set sc.doc = rc.RhinoDoc.ActiveDoc. [FIRST GH FILE]
  2. Now open a the gh file in which you are using ladybug [SECOND GH FILE]
  3. Copy the component from the first file to second file and it should not disrupt ladybug workflows.

I tried this and it worked at my end. Let us know how it goes at your end.