How to use LB+HB functions in a C# script

Dear friends and colleagues,

I am writing to ask if it is possible to use Ladybug and Honeybee functions in a C# scripting component or in Visual Studio under Grasshopper template?

If yes, is there any source to learn how to do that?

Thank you very much in advance,

Cheers,

Saeed

LB&HB is created by Python sothat I think it is impossible to decode into C#.

So, is it possible to use them in a Python scripting component?

You can use them in python components if you use the new libraries. The legacy plugin is not developed as a library so you have to copy-paste the code or load them from ladybug_ladybug component which is not very elegant. Here is the link to the new WIP libraries:

ladybug: https://github.com/ladybug-tools/ladybug

honeybee: https://github.com/ladybug-tools/honeybee

honeybee-grasshopper: https://github.com/ladybug-tools/honeybee-grasshopper

You can always wrap your python script in a file and call it from inside C# code. Also check this solution: https://github.com/pythonnet/pythonnet#example

1 Like

Thank you Mostapha,

Is there any sample code which shows how to use “lagacy honeybee for Grasshopper” for energy simulation?

There is no sample code but you can check the code inside Export to EnergyPlus and OpenStudio components. Click on Source code in these pages:

https://mostapharoudsari.gitbooks.io/honeybee-primer/content/text/c…

and

https://mostapharoudsari.gitbooks.io/honeybee-primer/content/text/c…

Thank you very much Mostapha, I do appreciate your consideration and support.