Hi everyone,
My current project consists in running Rhino and Grasshopper headless, from a python script, using the rhinoinside package. I have a Grasshopper file that i pretty much want to “translate” in python script, and it works pretty well, I can access a lot of different packages, which translate in extensions in grasshopper like ladybug, ladybug_rhino, ladybug_radiance. I am especially using the LB Incident Radiation, LB Cumulative SkyMatrix, LB Real Time Incident Radiation, ImportEPW and finally Analysis period.
This allows me to get the irradiance data under surfaces representing solar panels, hour by hour during the whole year, from python scripts, where I mainly imported code from grasshopper definitions.
The code is working perfectly well, I am able to have 8760 data corresponding to the irradiance of every single hour of the year. The only issue I face is that this data is the same regardless of the size, angles, lenght, width of the “context_”. The main goal of this project is to measure the ground irradiance under panels tracking the sun, so the “context_” needs to vary a lot.
The only way I found to create surfaces that works with Incident Radiation, from a python script is this one :
- Create and fill a Point3dList, named p
- Create and fill a PolylineCurve with p named C
- Create a surface from the RhinoGeometry function RhinoSurface.CreateExtrusion taking in input C and an orthogonal Vector3d to create a thin thickness
- Transform all thoses surfaces according to my needs, with Rhino.Geometry.Transform (angles, orientation, etc …)
- Converting them to a Brep using Rhino.Geometry.Surface.ToBrep()
The Brep is the object sent into the Incident Radiation function, more precisely under a list form because of this particular code line in Incident Rad :
shade_mesh = join_geometry_to_mesh(_geometry + [context_])
When I visualize the created Brep on Rhino I clearly see that it is very similar to what I had in the Grasshopper file, but I still suspect my way of creating the surface to be the source of my problems. The Incident Radiation Function is the exact same grasshopper definition, I copied and pasted it.
If you, from what is above, have any ideas of what I could modify, or I what I could test to find the exact origin of my mistakes, I take everything.
Also feel free to ask for more informations that could help, I may have not explained it in the best way.
Here is the github repo, please take a look if you’re highly motivated and willing to lose hair, it’s not disgusting code but I’m still a beginner.
Thanks a lot, and have a nice day !
Macéo