Component to refine the rays output from Ladybug's "Bounce from Surface component"

I just finished creating a new Grasshopper component that can be used to refine the sunrays output from “Bounce from Surface component”. The component takes into consideration nearby surfaces that might block sunrays from reaching the examined surface. Additionally, it solves the intersection of bounced light rays with a target surface, this is needed when the designer is looking to assess glare caused by reflective facades in urban environments. The component was created out of personal need; I was working on a project where I wanted to quickly estimate the effect of a reflective facade on the facade of a facing building (of course, not taking into account the detailed optical property of the reflective material, i.e. specular, diffuse…).

I attached the component and some images that show what the component can do. I’d appreciate comments and feedback.

Shading and Reflection Analysis.ghuser (4.5 KB)

Update:
Example file:
Shading and Reflection analysis.gh (487.4 KB)



5 Likes

@RaniaLabib, nice work! Thanks for sharing. Let’s see what other users think about this new component. To me it looks like a component that we should add to the official components. :+1:

1 Like

Thanks for sharing @RaniaLabib,
Like @mostapha, i think this can be useful for more than one and deserves a good home in LB.
-A.

1 Like

@mostapha and @AbrahamYezioro, thank you for your nice compliments. I wanted to incorporate the code into the ladybug component, but when I started modifying Mostapha’s code I got discouraged by the first few lines that have “sc.sticky” because I never really understood what sc.sticky is :grinning: I guess I need to improve my coding skills.

Hello @RaniaLabib,

Since you made this component, you already know enough I think.

Sticky is a dictionary that is available to all the components that live on the canvas. Open a new Gh file and do the following inside a GhPython component.Before

@mostapha is using this dictionary to dump all the classes from Ladybug_Ladybug and Honeybee_Honeybee and some other variables such as default folder. This is how it is done inside Ladybug_Ladybug

This is precisely why you need to have these components on canvas to use other components of Ladybug or Honeybee legacy. When you put Ladybug_Ladybug and Honeybee_Honeybee on canvas, they copy the classes to sticky.

When you put Ladybug_Ladybug on canvas, this is what happens;

So now, since these classes are loaded on a dictionary that is accessible to all components on canvas, the other components of Ladybug and Honeybee can use those classes.

Hope this helps!

2 Likes

Hi @RaniaLabib,

I want to try this new component. I am sure many others would like to as well. It will be much appreciated if you attach a GH sample. So that we just load and run it.

Hi @RaniaLabib,
I support @devang’s request.
I’m trying now something but get errors with the component. Like:

Runtime error (IndexOutOfRangeException): index out of range: 16
Traceback:
line 88, in script

or

Runtime error (NullReferenceException): Object reference not set to an instance of an object.
Traceback:
line 59, in script

-A.

1 Like

@devang, your post is very helpful, I searched online and I couldn’t figure out how sc.sticky is related to LB and HB. Not enough words to thank you. You’re so good you should consider making online tutorials. :grinning: I’m going to update my post with a sample file in a moment.

@AbrahamYezioro I just uploaded a sample file and added it to the original post. Could you try it out and let me know. I’d like to hear your feedback!

Thanks!

I probably need to add “try and except” to avoid some of the errors.

Did anyone try the example file yet?

Hi @RaniaLabib,
Yes. I started to test your file but need time to write my comments here. There are some. Hopefully i’ll do that by tomorrow. Sorry for the delay.
-A.

@AbrahamYezioro I’m not trying to rush anyone, please take your time. I think I’m just excited that I created a component. Although it’s not my first component, I feel that this one could be handy for other users.

Hi @RaniaLabib,
Sorry for the delay.
I’m writing as long as i find issues:

  1. When the LB_bounceFromSurface doesn’t output any rays your component crashes (red color). Add a warning about this.
  2. Tried to use your obstructingSrfs input geometry as input for the context in the LB component. It crashes yours (red). Seems to me obvious to allow this in order to reduce the rays, specially if they are not reaching the reflective surface from the beginning.
  3. See attached: AY_Shading and Reflection analysis.gh (509.2 KB)
    At the top ,blue group, is your component. At the bottom a version i regularly use to get the bouncing points on a desired surface. I’m not sure what i’m suggesting here. maybe to see if it will be possible to integrate your component with the existing LB? Adding an additional input “analysisSurface”? Instead of having two that the second is doing part of what the first is already doing?
    @mostapha: What do you think?
    That’s for now.
    -A.

@AbrahamYezioro

Sorry for the delay too!

Thank you for testing the component and providing a feedback. I’ll work on incorporating both components into the original HB component. I might take a long time though as I’m currently writing my PhD dissertation that’s consuming a lot of time.

Again, thanks! I appreciate it.

very nice work and keep going
I am also working on my PhD AND trying to create something
Hope that it will be useful

I am totally agree with Rania…