Ejemplo n.º 1
0
def test_clean_and_id_rad_string():
    """Test the clean_and_id_rad_string method."""
    correct_str = '0.5 in. Gypsum Wall'
    incorrect_str = '0.5 in., Gypsum Wall'
    long_str = 'This is an exceptionally long text string that should never be used ' \
        'for the name of anything in EnergyPlus but is actually ok for Radiance'

    assert clean_and_id_rad_string(correct_str).startswith('0.5in.GypsumWall')
    assert clean_and_id_rad_string(incorrect_str).startswith(
        '0.5in.GypsumWall')
    assert len(clean_and_id_rad_string(long_str)) > 70
try:
    from honeybee_radiance.view import View
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

VIEW_TYPES = ('v', 'h', 'l', 'c', 'a')

if all_required_inputs(ghenv.Component):
    # process the points/vectors into tuples
    _pos = (_position.X, _position.Y, _position.Z)
    _dir = (_direction.X, _direction.Y, _direction.Z)

    # set the default values
    name = clean_and_id_rad_string('View') if _name_ is None else _name_
    _up_vec = (_up_vector_.X, _up_vector_.Y, _up_vector_.Z) if _up_vector_ \
        is not None else (0, 0, 1)
    _type_ = 'v' if _view_type_ is None else VIEW_TYPES[_view_type_]
    _h_angle_ = 60 if _h_angle_ is None else _h_angle_
    _v_angle_ = 60 if _v_angle_ is None else _v_angle_

    view = View(clean_rad_string(name), _pos, _dir, _up_vec, _type_, _h_angle_,
                _v_angle_)
    if _name_ is not None:
        view.display_name = _name_
Ejemplo n.º 3
0
try:
    from honeybee_radiance.view import View
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

VIEW_TYPES = ('v', 'h', 'l', 'c', 'a')

if all_required_inputs(ghenv.Component):
    # process the points/vectors into tuples
    _pos = (_position.X, _position.Y, _position.Z)
    _dir = (_direction.X, _direction.Y, _direction.Z)

    # set the default values
    name = 'RadianceView' if _name_ is None else _name_
    _up_vec = (_up_vector_.X, _up_vector_.Y, _up_vector_.Z) if _up_vector_ \
        is not None else (0, 0, 1)
    _type_ = 'v' if _view_type_ is None else VIEW_TYPES[_view_type_]
    _h_angle_ = 60 if _h_angle_ is None else _h_angle_
    _v_angle_ = 60 if _v_angle_ is None else _v_angle_

    view = View(clean_and_id_rad_string(name), _pos, _dir, _up_vec, _type_,
                _h_angle_, _v_angle_)
    if _name_ is not None:
        view.display_name = _name_
Ejemplo n.º 4
0
ghenv.Component.AdditionalHelpFromDocStrings = '4'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:
    from honeybee_radiance.view import View
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
    from ladybug_rhino.viewport import viewport_by_name, viewport_properties
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

VIEW_TYPES = ('v', 'h', 'l', 'c', 'a')

# set the default values
_name_ = 'RadianceView' if _name_ is None else _name_
viewp = viewport_by_name(_viewport_)
v_props = viewport_properties(viewp, _view_type_)

view = View(clean_and_id_rad_string(_name_), v_props['position'],
            v_props['direction'], v_props['up_vector'],
            VIEW_TYPES[v_props['view_type']], v_props['h_angle'],
            v_props['v_angle'])
view.display_name = _name_
try:  # import the ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # check and duplicate the input objects
    group_shds = []
    for shd in _shades:
        assert isinstance(shd, Shade), 'Expected Shade ' \
            'for dynamic shade group. Got {}.'.format(type(shd))
        group_shds.append(shd.duplicate())

    # set the name of the dynamic group
    name = clean_and_id_rad_string(
        'ShadeGroup') if _name_ is None else clean_rad_string(_name_)
    for shd in group_shds:
        shd.properties.radiance.dynamic_group_identifier = name

    # assign any states if they are connected
    if len(states_) != 0:
        # convert the sub-face states to shade states
        shd_states = [
            RadianceShadeState(st.modifier, st.shades) for st in states_
        ]
        # assign states (including shades) to the first shade
        group_shds[0].properties.radiance.states = [
            state.duplicate() for state in shd_states
        ]

        # remove shades from following shades to ensure they aren't double-counted
    from honeybee.typing import clean_and_id_rad_string, clean_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:
    from honeybee_radiance.dynamic import StateGeometry
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import the ladybug_rhino dependencies
    from ladybug_rhino.togeometry import to_face3d
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))


if all_required_inputs(ghenv.Component):
    geo = []  # list of geometries that will be returned

    # set default name
    name = clean_and_id_rad_string('StateGeo') if _name_ is None \
        else clean_and_id_rad_string(_name_)

    # create the StateGeometry
    i = 0  # iterator to ensure each geometry gets a unique name
    for rh_geo in _geo:
        for lb_face in to_face3d(rh_geo):
            hb_geo = StateGeometry('{}_{}'.format(name, i), lb_face, _modifier_)
            if _name_ is not None:
                hb_geo.display_name = _name_
            geo.append(hb_geo)
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '0'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string, clean_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Plastic
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # set the default modifier properties
    _spec_ = 0.0 if _spec_ is None else _spec_
    _rough_ = 0.0 if _rough_ is None else _rough_
    name = clean_and_id_rad_string('OpaqueMaterial') if _name_ is None else \
        clean_rad_string(_name_)

    # create the modifier
    modifier = Plastic(name, _r_ref, _g_ref, _b_ref, _spec_, _rough_)
    if _name_ is not None:
        modifier.display_name = _name_
ghenv.Component.NickName = 'MetalMod3'
ghenv.Component.Message = '1.1.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '0'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Metal
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # set the default modifier properties
    _spec_ = 0.9 if _spec_ is None else _spec_
    _rough_ = 0.0 if _rough_ is None else _rough_

    # create the modifier
    modifier = Metal(clean_and_id_rad_string(_name), _r_ref, _g_ref, _b_ref,
                     _spec_, _rough_)
    modifier.display_name = _name
try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.sensorgrid import SensorGrid
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
    from ladybug_rhino.togeometry import to_mesh3d
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # set the default name and process the points to tuples
    name = 'SensorGrid' if _name_ is None else _name_
    pts = [(pt.X, pt.Y, pt.Z) for pt in _positions]

    # create the sensor grid object
    if len(_directions_) == 0:
        grid = SensorGrid.from_planar_positions(clean_and_id_rad_string(name),
                                                pts, (0, 0, 1))
    else:
        vecs = [(vec.X, vec.Y, vec.Z) for vec in _directions_]
        grid = SensorGrid.from_position_and_direction(
            clean_and_id_rad_string(name), pts, vecs)

    # set the display name
    if _name_ is not None:
        grid.display_name = _name_
    if mesh_ is not None:
        grid.mesh = to_mesh3d(mesh_)
try:  # import the ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # check and duplicate  the input objects
    group_aps = []
    for ap in _apertures:
        assert isinstance(ap, (Aperture, Door)), 'Expected Aperture or Door ' \
            'for dynamic group. Got {}.'.format(type(ap))
        group_aps.append(ap.duplicate())

    # set the name of the dynamic group
    name = clean_and_id_rad_string(_name_) if _name_ is not None else str(
        uuid.uuid4())
    for ap in group_aps:
        ap.properties.radiance.dynamic_group_identifier = name

    # assign any states if they are connected
    if len(states_) != 0:
        # assign states (including shades) to the first aperture
        group_aps[0].properties.radiance.states = [
            state.duplicate() for state in states_
        ]

        # remove shades from following apertures to ensure they aren't double-counted
        states_wo_shades = []
        for state in states_:
            new_state = state.duplicate()
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '2'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Trans
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))


if all_required_inputs(ghenv.Component):
    # set the default modifier properties
    _spec_ = 0.0 if _spec_ is None else _spec_
    _rough_ = 0.0 if _rough_ is None else _rough_

    # create the modifier
    modifier = Trans.from_single_reflectance(
        clean_and_id_rad_string(_name), _diff_ref, _spec_, _rough_,
        _diff_trans, _spec_trans)
    modifier.display_name = _name
ghenv.Component.Message = '1.1.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '2'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Metal
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))


if all_required_inputs(ghenv.Component):
    # set the default modifier properties
    _spec_ = 0.9 if _spec_ is None else _spec_
    _rough_ = 0.0 if _rough_ is None else _rough_

    # create the modifier
    modifier = Metal.from_single_reflectance(
        clean_and_id_rad_string(_name), _reflect, _spec_, _rough_)
    modifier.display_name = _name
ghenv.Component.NickName = 'OpaqueMod'
ghenv.Component.Message = '1.1.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '2'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Plastic
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # set the default modifier properties
    _spec_ = 0.0 if _spec_ is None else _spec_
    _rough_ = 0.0 if _rough_ is None else _rough_

    # create the modifier
    modifier = Plastic.from_single_reflectance(clean_and_id_rad_string(_name),
                                               _reflect, _spec_, _rough_)
    modifier.display_name = _name
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '0'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Trans
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))


if all_required_inputs(ghenv.Component):
    # set the default modifier properties
    _spec_ = 0.0 if _spec_ is None else _spec_
    _rough_ = 0.0 if _rough_ is None else _rough_

    # create the modifier
    modifier = Trans(
        clean_and_id_rad_string(_name), _r_diff_ref, _g_diff_ref, _b_diff_ref,
        _spec_, _rough_, _diff_trans, _spec_trans)
    modifier.display_name = _name
Ejemplo n.º 15
0
ghenv.Component.Name = 'HB Mirror Modifier 3'
ghenv.Component.NickName = 'MirrorMod3'
ghenv.Component.Message = '1.2.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = "1 :: Modifiers"
ghenv.Component.AdditionalHelpFromDocStrings = '0'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_rad_string, clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Mirror
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    name = clean_and_id_rad_string('MirrorMaterial') if _name_ is None else \
        clean_rad_string(_name_)

    # create the modifier
    modifier = Mirror(name, _r_ref, _g_ref, _b_ref)
    if _name_ is not None:
        modifier.display_name = _name_
Ejemplo n.º 16
0
ghenv.Component.Message = '1.1.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '0'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Plastic
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))


if all_required_inputs(ghenv.Component):
    # set the default modifier properties
    _spec_ = 0.0 if _spec_ is None else _spec_
    _rough_ = 0.0 if _rough_ is None else _rough_

    # create the modifier
    modifier = Plastic(
        clean_and_id_rad_string(_name), _r_ref, _g_ref, _b_ref, _spec_, _rough_)
    modifier.display_name = _name
"""

ghenv.Component.Name = 'HB Glass Modifier 3'
ghenv.Component.NickName = 'GlassMod3'
ghenv.Component.Message = '1.1.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '0'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Glass
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # create the modifier
    modifier = Glass.from_transmittance(clean_and_id_rad_string(_name),
                                        _r_trans, _g_trans, _b_trans,
                                        _refract_)
    modifier.display_name = _name
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.sensorgrid import SensorGrid
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
    from ladybug_rhino.togeometry import to_mesh3d, to_face3d
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # set the default name and process the points to tuples
    name = clean_and_id_rad_string('SensorGrid') if _name_ is None else _name_
    pts = [(pt.X, pt.Y, pt.Z) for pt in _positions]

    # create the sensor grid object
    id = clean_rad_string(name) if '/' not in name else clean_rad_string(
        name.split('/')[0])
    if len(_directions_) == 0:
        grid = SensorGrid.from_planar_positions(id, pts, (0, 0, 1))
    else:
        vecs = [(vec.X, vec.Y, vec.Z) for vec in _directions_]
        grid = SensorGrid.from_position_and_direction(id, pts, vecs)

    # set the display name
    if _name_ is not None:
        grid.display_name = _name_
    if '/' in name:
try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifierset import ModifierSet
    from honeybee_radiance.lib.modifiersets import modifier_set_by_identifier
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # get the base modifier set
    if base_mod_set_ is None:
        mod_set = ModifierSet(clean_and_id_rad_string(_name))
    else:
        if isinstance(base_mod_set_, str):
            base_mod_set_ = modifier_set_by_identifier(base_mod_set_)
        mod_set = base_mod_set_.duplicate()
        mod_set.identifier = clean_and_id_rad_string(_name)
        mod_set.display_name = _name

    # go through each input modifier subset and assign it to the set
    if len(_exterior_subset_) != 0:
        assert len(
            _exterior_subset_) == 3, 'Input _exterior_subset_ is not valid.'
        if _exterior_subset_[0] is not None:
            mod_set.wall_set.exterior_modifier = _exterior_subset_[0]
        if _exterior_subset_[1] is not None:
            mod_set.roof_ceiling_set.exterior_modifier = _exterior_subset_[1]
ghenv.Component.Name = 'HB Glass Modifier'
ghenv.Component.NickName = 'GlassMod'
ghenv.Component.Message = '1.2.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '2'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string, clean_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Glass
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    name = clean_and_id_rad_string('GlassMaterial') if _name_ is None else \
        clean_rad_string(_name_)

    # create the modifier
    modifier = Glass.from_single_transmittance(name, _trans, _refract_)
    if _name_ is not None:
        modifier.display_name = _name_
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifierset import ModifierSet
    from honeybee_radiance.lib.modifiersets import modifier_set_by_identifier
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # get the base modifier set
    name = clean_and_id_rad_string('ModifierSet') if _name_ is None else \
        clean_rad_string(_name_)
    if base_mod_set_ is None:
        mod_set = ModifierSet(name)
    else:
        if isinstance(base_mod_set_, str):
            base_mod_set_ = modifier_set_by_identifier(base_mod_set_)
        mod_set = base_mod_set_.duplicate()
        mod_set.identifier = name
        if _name_ is not None:
            mod_set.display_name = _name_

    # go through each input modifier subset and assign it to the set
    if len(_exterior_subset_) != 0:
        assert len(
            _exterior_subset_) == 3, 'Input _exterior_subset_ is not valid.'
        modifier: An mirror modifier that can be assigned to a Honeybee geometry
            or Modifier Sets.
"""

ghenv.Component.Name = 'HB Mirror Modifier 3'
ghenv.Component.NickName = 'MirrorMod3'
ghenv.Component.Message = '1.1.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = "1 :: Modifiers"
ghenv.Component.AdditionalHelpFromDocStrings = '0'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Mirror
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # create the modifier
    modifier = Mirror(clean_and_id_rad_string(_name), _r_ref, _g_ref, _b_ref)
    modifier.display_name = _name
Ejemplo n.º 23
0
try:  # import the ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # check and duplicate  the input objects
    group_aps = []
    for ap in _apertures:
        assert isinstance(ap, (Aperture, Door)), 'Expected Aperture or Door ' \
            'for dynamic group. Got {}.'.format(type(ap))
        group_aps.append(ap.duplicate())

    # set the name of the dynamic group
    name = clean_and_id_rad_string(
        'ApertureGroup') if _name_ is None else clean_rad_string(_name_)
    for ap in group_aps:
        ap.properties.radiance.dynamic_group_identifier = name

    # assign any states if they are connected
    if len(states_) != 0:
        # assign states (including shades) to the first aperture
        group_aps[0].properties.radiance.states = [
            state.duplicate() for state in states_
        ]

        # remove shades from following apertures to ensure they aren't double-counted
        states_wo_shades = []
        for state in states_:
            new_state = state.duplicate()
            new_state.remove_shades()
            or Modifier Sets.
"""

ghenv.Component.Name = 'HB Mirror Modifier'
ghenv.Component.NickName = 'MirrorMod'
ghenv.Component.Message = '1.1.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '1 :: Modifiers'
ghenv.Component.AdditionalHelpFromDocStrings = '2'

try:  # import the core honeybee dependencies
    from honeybee.typing import clean_and_id_rad_string
except ImportError as e:
    raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try:  # import the honeybee-radiance dependencies
    from honeybee_radiance.modifier.material import Mirror
except ImportError as e:
    raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))

try:  # import ladybug_rhino dependencies
    from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if all_required_inputs(ghenv.Component):
    # create the modifier
    modifier = Mirror.from_single_reflectance(clean_and_id_rad_string(_name),
                                              _reflect)
    modifier.display_name = _name