honeybee_radiance.modifier.material.glass module

Radiance Glass Material.

http://radsite.lbl.gov/radiance/refer/ray.html#Glass

class honeybee_radiance.modifier.material.glass.Glass(identifier, r_transmissivity=0.0, g_transmissivity=0.0, b_transmissivity=0.0, refraction_index=None, modifier=None, dependencies=None)[source]

Bases: Material

Radiance glass material.

Parameters
  • identifier – Text string for a unique Material ID. Must not contain spaces or special characters. This will be used to identify the object across a model and in the exported Radiance files.

  • r_transmissivity – Transmissivity for red. The value should be between 0 and 1 (Default: 0).

  • g_transmissivity – Transmissivity for green. The value should be between 0 and 1 (Default: 0).

  • b_transmissivity – Transmissivity for blue. The value should be between 0 and 1 (Default: 0).

  • refraction_index – Index of refraction. Typical values are 1.52 for float glass and 1.4 for ETFE. If None, Radiance will default to using 1.52 for glass (Default: None).

  • modifier – Material modifier (Default: None).

  • dependencies – A list of primitives that this primitive depends on. This argument is only useful for defining advanced primitives where the primitive is defined based on other primitives. (Default: [])

Properties:
  • identifier

  • display_name

  • r_transmissivity

  • g_transmissivity

  • b_transmissivity

  • refraction_index

  • average_transmissivity

  • average_transmittance

  • values

  • modifier

  • dependencies

  • is_modifier

  • is_material

Usage:

glass_material = Glass("generic_glass", .65, .65, .65)
print(glass_material)
ToString()

Overwrite .NET ToString.

add_dependent(dep)

Add dependent.

duplicate()

Get a copy of this object.

static filter_dict_input(input_dict)

Filter a dictionary of a Primitive to get modifier and dependency objects.

classmethod from_dict(data)[source]

Initialize Glass from a dictionary.

Parameters

data – A dictionary in the format below.

{
"type": "Glass",
"identifier": "",  # Material identifier
"display_name": "",  # Material display name
"r_transmissivity": float,  # Transmissivity for red
"g_transmissivity": float,  # Transmissivity for green
"b_transmissivity": float,  # Transmissivity for blue
"refraction_index": float,  # Index of refraction
"modifier": {},  # material modifier (Default: None)
"dependencies": []
}
classmethod from_primitive_dict(primitive_dict)[source]

Initialize Glass from a primitive dict.

Parameters

data – A dictionary in the format below.

{
"modifier": {},  # primitive modifier (Default: None)
"type": "glass",  # primitive type
"identifier": "",  # primitive identifier
"display_name": "",  # primitive display name
"values": [] , # values
"dependencies": []
}
classmethod from_single_transmissivity(identifier, rgb_transmissivity=0, refraction_index=None, modifier=None, dependencies=None)[source]

Create glass material with single transmissivity value.

Parameters
  • identifier – Text string for a unique Material ID. Must not contain spaces or special characters. This will be used to identify the object across a model and in the exported Radiance files.

  • rgb_transmissivity – Transmissivity for red, green and blue. The value should be between 0 and 1 (Default: 0).

  • refraction_index – Index of refraction. Typical values are 1.52 for float glass and 1.4 for ETFE. If None, Radiance will default to using 1.52 for glass (Default: None).

  • modifier – Material modifier (Default: None).

  • dependencies – A list of primitives that this primitive depends on. This argument is only useful for defining advanced primitives where the primitive is defined based on other primitives. (Default: [])

Usage:

glassMaterial = Glass.from_single_transmissivity("generic glass", .65)
print(glassMaterial)
classmethod from_single_transmittance(identifier, rgb_transmittance=0, refraction_index=None, modifier=None, dependencies=None)[source]

Create glass material with single transmittance value.

Parameters
  • identifier – Text string for a unique Material ID. Must not contain spaces or special characters. This will be used to identify the object across a model and in the exported Radiance files.

  • rgb_transmittance – Transmittance for red, green and blue. The value should be between 0 and 1 (Default: 0).

  • refraction_index – Index of refraction. Typical values are 1.52 for float glass and 1.4 for ETFE. If None, Radiance will default to using 1.52 for glass (Default: None).

  • modifier – Material modifier (Default: None).

  • dependencies – A list of primitives that this primitive depends on. This argument is only useful for defining advanced primitives where the primitive is defined based on other primitives. (Default: [])

Usage:

glassMaterial = Glass.from_single_transmittance("generic glass", .65)
print(glassMaterial)
classmethod from_string(primitive_string)

Create a Radiance primitive from a string.

If the primitive modifier is not void or it has other dependencies, the modifier and/or dependencies must also be part of the input string.

classmethod from_transmittance(identifier, r_transmittance=0.0, g_transmittance=0.0, b_transmittance=0.0, refraction_index=None, modifier=None, dependencies=None)[source]

Create glass material from transmittance values.

Radiance uses transmissivity values while glass manufactures provide the value for transmittance. This method does the conversion from transmittance to transmissivity.

Parameters
  • identifier – Text string for a unique Material ID. Must not contain spaces or special characters. This will be used to identify the object across a model and in the exported Radiance files.

  • r_transmittance – Transmittance for red. The value should be between 0 and 1 (Default: 0).

  • g_transmittance – Transmittance for green. The value should be between 0 and 1 (Default: 0).

  • b_transmittance – Transmittance for blue. The value should be between 0 and 1 (Default: 0).

  • refraction_index – Index of refraction. Typical values are 1.52 for float glass and 1.4 for ETFE. If None, Radiance will default to using 1.52 for glass (Default: None).

  • modifier – Material modifier (Default: None).

  • dependencies – A list of primitives that this primitive depends on. This argument is only useful for defining advanced primitives where the primitive is defined based on other primitives. (Default: [])

Usage:

glass_material = Glass.from_transmittance("generic_glass", .60, .60, .60)
print(glass_material)
lock()
to_dict()[source]

Translate this object to a dictionary.

to_radiance(minimal=False, include_modifier=True, include_dependencies=True)

Return full radiance definition.

Parameters
  • minimal – Boolean to note whether the radiance string should be written in a minimal format (with spaces instead of line breaks). Default: False.

  • include_modifier – Boolean to note whether the modifier of this primitive should be included in the string. Default: True.

  • include_dependencies – Boolean to note whether the dependencies of this primitive should be included in the string. Default: True.

static transmissivity_from_transmittance(transmittance)[source]

Calculate transmissivity based on transmittance value.

Transmissivity is the amount of light not absorbed in one traversal of the material.

Transmittance (the value usually measured) is the total light transmitted through the material pane including multiple reflections inside of the glass pane.

static transmittance_from_transmissivity(transmissivity)[source]

Calculate transmittance based on transmissivity value.

Transmittance (the value usually measured) is the total light transmitted through the material pane including multiple reflections inside of the glass pane.

Transmissivity is the amount of light not absorbed in one traversal of the material.

unlock()
GEOMETRYTYPES = {'bubble', 'cone', 'cup', 'cylinder', 'instance', 'mesh', 'polygon', 'ring', 'source', 'sphere', 'tube'}
MATERIALTYPES = {'BRTDfunc', 'BSDF', 'aBSDF', 'antimatter', 'ashik2', 'dielectric', 'glass', 'glow', 'illum', 'interface', 'light', 'metal', 'metal2', 'metdata', 'metfunc', 'mirror', 'mist', 'mixedfunc', 'plasdata', 'plasfunc', 'plastic', 'plastic2', 'prism1', 'prism2', 'spotlight', 'trans', 'trans2', 'transdata', 'transfunc'}
MIXTURETYPES = {'mixdata', 'mixfunc', 'mixpict', 'mixtext'}
MODIFIERTYPES = {'BRTDfunc', 'BSDF', 'aBSDF', 'antimatter', 'ashik2', 'brightdata', 'brightfunc', 'brighttext', 'colordata', 'colorfunc', 'colorpict', 'colortext', 'dielectric', 'glass', 'glow', 'illum', 'interface', 'light', 'metal', 'metal2', 'metdata', 'metfunc', 'mirror', 'mist', 'mixdata', 'mixedfunc', 'mixfunc', 'mixpict', 'mixtext', 'plasdata', 'plasfunc', 'plastic', 'plastic2', 'prism1', 'prism2', 'spotlight', 'texdata', 'texfunc', 'trans', 'trans2', 'transdata', 'transfunc'}
NONEOPAQUETYPES = {'BRTDfunc', 'BSDF', 'aBSDF', 'dielectric', 'glass', 'mist', 'mixfunc', 'prism1', 'prism2', 'trans', 'trans2', 'transdata', 'transfunc'}
PATTERNTYPES = {'brightdata', 'brightfunc', 'brighttext', 'colordata', 'colorfunc', 'colorpict', 'colortext'}
TEXTURETYPES = {'texdata', 'texfunc'}
TYPES = {'BRTDfunc', 'BSDF', 'aBSDF', 'antimatter', 'ashik2', 'brightdata', 'brightfunc', 'brighttext', 'bubble', 'colordata', 'colorfunc', 'colorpict', 'colortext', 'cone', 'cup', 'cylinder', 'dielectric', 'glass', 'glow', 'illum', 'instance', 'interface', 'light', 'mesh', 'metal', 'metal2', 'metdata', 'metfunc', 'mirror', 'mist', 'mixdata', 'mixedfunc', 'mixfunc', 'mixpict', 'mixtext', 'plasdata', 'plasfunc', 'plastic', 'plastic2', 'polygon', 'prism1', 'prism2', 'ring', 'source', 'sphere', 'spotlight', 'texdata', 'texfunc', 'trans', 'trans2', 'transdata', 'transfunc', 'tube'}
property average_transmissivity

Get the average transmissivity.

The value is calculated by multiplying the r, g, b values by v-lambda.

property average_transmittance

Get the average transmittance.

The value is calculated by multiplying the r, g, b values by v-lambda.

property b_transmissivity

get or set the transmissivity for blue channel.

The value should be between 0 and 1 (Default: 0).

property b_transmittance

Get or set the transmittance for blue channel.

property dependencies

Get list of dependencies for this primitive.

Additional dependencies can be added with the add_dependent method.

property display_name

Get or set a string for the object name without any character restrictions.

If not set, this will be equal to the identifier.

property g_transmissivity

Get or set the transmissivity for green channel.

The value should be between 0 and 1 (Default: 0).

property g_transmittance

Get or set the transmittance for green channel.

property identifier

Get or set a text string for the unique primitive identifier.

property is_geometry

Get a boolean noting whether this object is a Radiance geometry.

property is_material

Get a boolean noting whether this object is a material modifier.

property is_mixture

Get a boolean noting whether this object is a mixture modifier.

property is_modifier

Get a boolean indicating whether this object is a Radiance modifier.

Modifiers include materials, mixtures, textures and patterns.

property is_opaque

Get or set a boolean to indicate whether this primitive is opaque.

This property is used to separate opaque and non-opaque geometries as well as modifiers.

property is_pattern

Get a boolean noting whether this object is a pattern modifier.

property is_texture

Get a boolean noting whether this object is a texture modifier.

property is_void

Only true for a void.

property modifier

Get or set an object for the primitive modifier.

property r_transmissivity

Get or set the transmissivity for red channel.

The value should be between 0 and 1 (Default: 0).

property r_transmittance

Get or set the transmittance for red channel.

property refraction_index

Get or set the index of refraction.

Typical values are 1.52 for float glass and 1.4 for ETFE. If None, Radiance will default to using 1.52 for glass.

property type

Get or set a string for the primitive type.

This should always be lower case in order to match the radiance convention.

property values

Get or set the values of the current primitive as a list of three lists.

Each sub-list represents a line of the primitive’s radiance representation and contain the properties that define the primitive.

Usage:

# This will erase all values except the first line, which has 9 custom items
primitive.values = [
    [0.5, 0.5, 0.5, "/usr/oak.pic", ".", "frac(U)", "frac(V)", "-s", 1.1667],
    [],
    []
]