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

#1

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

#2

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

#3

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

#4

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
#5

Thank you Mostapha,

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

#6

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…

#7

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