Cannot read hbjson models files in GH that is created with scripting because of non recognized construction set

Check_json_geometry_21_06_30_Discourse.gh (62.2 KB) generic_to_modify.hbjson (82.0 KB) generic_to_modify.hbjson (82.0 KB) standard.hbjson (89.8 KB) test_construction.py (2.0 KB)

Hi,

I am creating my HB models with Python only (outside Grasshopper), but I still use Grasshopper to visualize and check my models, using the “HB load object” component.

However I am having some issues when I use sets of constructions: if I apply a set of constructions (besides the default generic construction set) the “load object” component does not want to read the json file with the model and I have “1. Solution exception:Failed to apply energy properties to the Model: Failed to find layers in materials.” error, even though the constructions set I used is by default in the Ladybug Tool.

I attached some example files:

  • 3 hbjson files generated with Python containing a HB model (put them in the same folder to use the python program and the Grasshopper file below):

    • generic, with the generic construction set
    • standard, with a standard construction set from the ladybug tool library (natively)
    • generic_to_modify, identical to generic, but when you launch the python program below one of the room will have the standard constructions set applied to one of its room (and thus could not be read by Grasshopper)
  • a python program, test_construction.py, that read the hbjson files, show the constructions set, and apply the standard constructions set on generic_to_modify.hbjson

  • a Grasshopper file to visualize the hbjson models.

I applied the construction set on the rooms in the standard.hbjson the same way I did in the python program line 26 when I modify generic_to_modify.hbjson,maybe my problem comes from the way I apply the constructions set… Can you tell me if it is correct ? and hopefully where the mistake comes from?

Notes:

  • I can read the hbjson file in Python, it does not have problem with the construction sets.
  • I don’t have problems with the program sets for instance.
  • if I modify the construction set in Grasshopper of the generic.hbjson file, export it to hbjson again and read it I don’t have this issue. (see the generated generic_mod_GH.hbjson)

Tell me if you have some issues launching the python program (you will obviously need the Ladybug/Honeybee/Honeybee-energy/Honeybee standard libraries installed), I am using a Conda virtual environment with Pycharm (editor), I am not sure of how it behaves outside this environment.

Thank you in advance !

Best,

Elie

Cool stuff you are doing here, @Elie_MED !

This issue is happening because you have different versions of the Ladybug Tools core libraries installed between your system Python and that used by the LBT Grasshopper plugin. If you upgrade your LBT Grasshopper plugin by using the “LB Versioner” component and then restart Rhino/Grasshopper, you should be able to load the HBJSON file you created. Also note that you can always update the version of Ladybug Tools libraries installed to your system Python by running:

pip install lbt-dragonfly -U

2 Likes

Hi @chris,

Thank you, it’s a really good idea you had to make Ladybug available for Python only as well, it substantially widen the possibilities. I hope to have interesting things to share with the community soon.

Thank you for you answer, it solved the issue !

1 Like