How to extract programs and constructions

Hi there,

I am trying to deconstruct the hbjson to extract programs and constructions, but I cannot find any component that allows retrieving such information from room objects.
As far as I know, such information should be present in the hbjson file, as their names can be visualised through the appropriate visualisation components.
Does anyone know if it is possible to accomplish this?

Thanks
Matteo

Hello @chris, do you have any advice about this?

Hi @MatteoMerli,

You can get this functionality with a simple python component.

For example, starting with a model and the default GHPython component, plug the HB Model object into the x input.

Then if you open the component and add at the bottom

for room in x.rooms:
    a = room.properties.energy.program_type 

Then when you press ok, the an output of the GHPython component should give you the program types for each room.

Typing this on my phone so trying to do this from memory!

If you look here it shows you what other properties are available on each room using python, including construction_set, etc.

https://www.ladybug.tools/honeybee-energy/docs/honeybee_energy.properties.room.html

2 Likes

Thanks @charlie.brooker, it works!
I adjusted the code to get program types for each room instead of just the first one:

programs = []
for room in x.rooms:
    programs.append(room.properties.energy.program_type)
a = programs

This method only works if the input is the entire model. Do you know what changes I should make to use individual rooms as input? This could be useful for other codes with faces as well.

1 Like

Nice work @MatteoMerli!

If you’re inputting rooms then x becomes “rooms” instead of a model. So in this case you should need an even simpler bit of code removing for loop that goes through each room like so:

a = x.properties.energy.program_type

I think if you give this a list of rooms you should get a list of program_types out, without the need for appending a list, but I could be wrong.

Likewise if you make the x input faces then you can access the face properties like so

a = x.properties.energy.INSERT_FACE_PROPERTY

You can find the available face properties here:
https://www.ladybug.tools/honeybee-energy/docs/honeybee_energy.properties.face.html

1 Like

Really glad to see you using the LBT Python SDK since that’s the ultimate answer to getting any attribute that you want for a Honeybee object (even those not exposed on the visualization components). It’s also the most efficient way to get the attribute.

I just wanted to add something in case there are some users watching this topic who are not yet at the level of using the LBT Python SDK. You can also use the HB Color Room Attributes and the HB Color Face Attributes components to get the attributes assigned to any Honeybee Room, Face or Aperture/Door. And you can see that the components return the actual object, which can be deconstructed with other components (not just the name of the attribute):


get_honeybee_attributes.gh (60.2 KB)

So you can use that if you need a solution with the existing LBT Grasshopper components.

3 Likes

Hi @charlie.brooker and @chris,

many thanks for your answers!

Best,
Matteo

1 Like