Import a material from Radiance library in Honeybee[+] and BRTDfunc material

Is there any way I can import Radiance material from the library in Honeybee[+]? currently, I have to build the material from scratch using the material components or custom made components, but I was hoping I can use the traditional way of importing Radiance material from the library (inputting the name of the material into the HB surface component). If this is not possible can someone help me write a custom BRTDfunc? I understand that I have to import the material definition from the Radiance material class using:

from honeybee.radiance.material.brtdfunc import BRTDfunc

I checked the and obviously, the definition has nothing but “pass” does this mean that I only need to write a string?

There is currently no library for Honeybee[+].

Can you share the BRTDfunc material definition that you are trying to create?

Hi @mostapha, here is the material definition:

void BRTDfunc  H_mod
10  rR_bronze rG_bronze rB_bronze  0.41*tR_bronze   0.437*tG_bronze   0.409*tB_bronze   0 0 0
15 0 0 0 0 0 0 0 0 0   0.907       0.885    0.921    0.937       0.902    0.894 


from honeybee.radiance.material.brtdfunc import BRTDfunc

values = {
0: ['rG_bronze', 'rB_bronze', '0.41*tR_bronze', '0.437*tG_bronze', '0.409*tB_bronze', '0', '0', '0', ''],
1: [],
2: ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0.907', '0.885', '0.921', '0.937', '0.902', '0.894']

material = BRTDfunc('H_mod', values=values)


You can also use from_string method.

Thank you so much @mostapha!

when I use the BRTDfunc component you wrote in the post above I get an error in the cmd window that says:
bad arguments for material “H_mod”

@RaniaLabib, That’s the file for black materials which is used for direct calculation. Check *..opq.mat file for the original materials.

I can’t recreate the error with BRTDfunc. Can you give me the full error message with line number?

@mostapha, My bad, the material definitions are correct in the opaque material file.
I found the problem with the BRTDfunc material
I copied and pasted your code, but it turned out that there was a value missing in the first line, also the second line has to have an empty list . the following code fixed the problem

values = {
             0: ['rR_bronze','rG_bronze', 'rB_bronze', '0.41*tR_bronze', '0.437*tG_bronze', '0.409*tB_bronze', '0', '0', '0', ''],
             1: [],
             2: ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0.907', '0.885', '0.921', '0.937', '0.902', '0.894']

All is good now, thanks!


Hi @RaniaLabib

would this method be also valid for translucent materials?

Yes. This method is valid for all Radiance materials and actually all radiance primitives.

For translucent materials the API is more developed and you have more options:

Hi @OlivierDambron, I didn’t realize you tagged me until @mostapha answered the question, My apology.
Mostapha developed many Radiance primitives, all that you have to do is write your own Python component based on the Python Radiance materials files in the following directory:

For example, a trans material that has R,G,and B reflectance of 60% can be defined like this:

from honeybee.radiance.material.trans import Trans
Some_Material = Trans.by_single_reflect_value("Trans_Material", .60)

This code will write the following material:

void trans Trans_Material
7 0.6 0.6 0.6 0.0 0.0 0.0 0.0

Hello - @RaniaLabib @mostapha -

I have been really struggling to get custom materials to work in Honeybee +

We are trying to do a material (which we have executed successfully in legacy). But before we do that we are at least trying to get any custom specified material to be recognized.

I used @RaniaLabib last example for a basic trans material, created one for trans, one for plastic but for both I get an assertion error, even though the python component and data being outputted seem to be correct.

To note when I plug in the existing Honeybee + component for opaque construction with the same values, it does read that one just fine.

Is this AssertionError because there was an updated with Honeybee + since this thread? And if so, how do we custom define materials now?

Thank you!! (14.2 KB)

A colleague of mine may have identified the problem. Sending the output to print as opposed to A might be the issue. Will confirm when I am able to verify this has resolved the issue.

That is correct! In Honeybee[+] library the objects are python objects and not strings. When you print them out they will be cast to string which means you are passing a string and not a radiance material to the next component.

Thanks @mostapha ! We have successfully got a basic material to run. We now have a new question, which goes back to the original bigger question.

How do we use mixfunc without a library to reference other materials we create for the mixfunc?

As we need to reference other materials we create in the mixfunc, it is not clear how to do that in the python code.

Any insight on how to get the mixfunc to reference other custom materials will be most helpful. do they need to be in the same python script? Do we want to recreate the file? (Even if we do it’s not clear how to reference another material)

thank you!