raise ValueError( '_constr_set_ has been specified but dragonfly-energy ' 'has failed to import.\n{}'.format(e)) elif len(conditioned_) != 0: raise ValueError( 'conditioned_ has been specified but dragonfly-energy ' 'has failed to import.\n{}'.format(e)) if all_required_inputs(ghenv.Component): room2d = [] # list of room2ds that will be returned face3ds = [face for geo in _geo for face in to_face3d(geo)] # convert to lb geo for i, geo in enumerate(face3ds): # get the name for the Room2D if len(_name_) == 0: # make a default Room2D name display_name = 'Room_{}'.format(document_counter('room_count')) else: display_name = '{}_{}'.format(longest_list(_name_, i), i + 1) \ if len(_name_) != len(face3ds) else longest_list(_name_, i) name = clean_and_id_string(display_name) # create the Room2D room = Room2D(name, geo, longest_list(_flr_to_ceiling, i), tolerance=tolerance) room.display_name = display_name # assign the program if len(_program_) != 0: program = longest_list(_program_, i)
_construction = opaque_construction_by_identifier(_construction) # determine whether the input _geo_or_area is geometry or floats try: areas = [float(num) for num in _geo_or_area] except AttributeError: # assume that the input is a list of geometry geo = [f for geo in _geo_or_area for f in to_face3d(geo)] conversion = conversion_to_meters()**2 areas = [0 for room in rooms] for i, room in enumerate(rooms): for face in geo: if room.geometry.is_point_inside(face.center): areas[i] += face.area * conversion # create the internal mass objects and assign them to the rooms for i, room in enumerate(rooms): area = longest_list(areas, i) if area != 0: if len(_name_) == 0: # make a default Room name display_name = 'Internal Mass {}'.format( document_counter('mass_count')) else: display_name = '{}_{}'.format(longest_list(_name_, i), i + 1) \ if len(_name_) != len(_rooms) else longest_list(_name_, i) name = clean_ep_string(display_name) mass = InternalMass(name, _construction, area) mass.display_name = display_name room.properties.energy.add_internal_mass(mass) print('Internal mass with area {} m2 has been added to room ' '"{}"'.format(round(area, 3), room.display_name))
from honeybee_energy.lib.schedules import schedule_by_identifier except ImportError as e: if len(ep_constr_) != 0: raise ValueError('ep_constr_ has been specified but honeybee-energy ' 'has failed to import.\n{}'.format(e)) elif len(ep_trans_sch_) != 0: raise ValueError('ep_trans_sch_ has been specified but honeybee-energy ' 'has failed to import.\n{}'.format(e)) if all_required_inputs(ghenv.Component): context = [] # list of context shades that will be returned for i, geo in enumerate(_geo): # get the name for the ContextShade if len(_name_) == 0: # make a default name display_name = 'Context_{}'.format(document_counter('context_count')) else: display_name = '{}_{}'.format(longest_list(_name_, i), i + 1) \ if len(_name_) != len(_geo) else longest_list(_name_, i) name = clean_and_id_string(display_name) # create the ContextShade object df_shd = ContextShade(name, to_face3d(geo)) df_shd.display_name = display_name # try to assign the energyplus construction if len(ep_constr_) != 0: ep_constr = longest_list(ep_constr_, i) if isinstance(ep_constr, str): ep_constr = shade_construction_by_identifier(ep_constr) df_shd.properties.energy.construction = ep_constr
elif len(_constr_set_) != 0: raise ValueError( '_constr_set_ has been specified but dragonfly-energy ' 'has failed to import.\n{}'.format(e)) elif len(conditioned_) != 0: raise ValueError( 'conditioned_ has been specified but dragonfly-energy ' 'has failed to import.\n{}'.format(e)) if all_required_inputs(ghenv.Component) and _run: perim_offset_ = 0 if perim_offset_ is None else perim_offset_ buildings = [] # list of buildings that will be returned for i, geo in enumerate(_footprint_geo): # get the name for the Building if len(_name_) == 0: # make a default Building name display_name = 'Building_{}'.format(document_counter('bldg_count')) name = clean_and_id_string(display_name) else: display_name = '{}_{}'.format(longest_list(_name_, i), i + 1) \ if len(_name_) != len(_footprint_geo) else longest_list(_name_, i) name = clean_string(display_name) # create the Building building = Building.from_footprint( name, footprint=to_face3d(geo), floor_to_floor_heights=_floor_to_floor, perimeter_offset=perim_offset_, tolerance=tolerance) building.display_name = display_name
try: # import the dragonfly-energy extension import dragonfly_energy from honeybee_energy.lib.constructionsets import construction_set_by_identifier except ImportError as e: if _constr_set_ is not None: raise ValueError( '_constr_set_ has been specified but dragonfly-energy ' 'has failed to import.\n{}'.format(e)) if all_required_inputs(ghenv.Component): # duplicate the initial objects room2ds = [room.duplicate() for room in _room2ds] # generate a default name if _name_ is None: # get a default Story name display_name = 'Story_{}'.format(document_counter('story_count')) name = clean_and_id_string(display_name) else: display_name = _name_ name = clean_string(display_name) # set other defaults multiplier_ = multiplier_ if multiplier_ is not None else 1 # create the Story story = Story(name, room2ds, _flr_to_flr_, _flr_height_, multiplier_) story.display_name = display_name # assign the construction set if _constr_set_ is not None: if isinstance(_constr_set_, str):
wire_objs = [] for wire in _wires: if isinstance(wire, str): wire_objs.append(wire_by_identifier(wire)) else: wire_objs.append(wire) # convert rhino geometry to ladybug geometry lines = [] for geo in _geo: try: lines.append(to_polyline2d(geo)) except AttributeError: lines.append(to_linesegment2d(geo)) connector = [] # list of connectors that will be returned for i, geo in enumerate(lines): # get the name for the ElectricalConnector if len(_name_) == 0: # make a default ElectricalConnector name display_name = 'ElectricalConnector_{}'.format( document_counter('e_connector_count')) else: display_name = '{}_{}'.format(longest_list(_name_, i), i + 1) \ if len(_name_) != len(lines) else longest_list(_name_, i) name = clean_and_id_ep_string(display_name) # create the ElectricalConnector conn = ElectricalConnector(name, geo, wire_objs) conn.display_name = display_name connector.append(conn)
try: # import ladybug-rhino from ladybug_rhino.togeometry import to_polygon2d from ladybug_rhino.grasshopper import all_required_inputs, longest_list, \ document_counter except ImportError as e: raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e)) if all_required_inputs(ghenv.Component): transformer = [] # list of transformers that will be returned polygons = [to_polygon2d(geo) for geo in _geo] # convert to lb geo for i, geo in enumerate(polygons): # get the name for the Transformer if len(_name_) == 0: # make a default Transformer name display_name = 'Transformer_{}'.format( document_counter('transformer_count')) else: display_name = '{}_{}'.format(longest_list(_name_, i), i + 1) \ if len(_name_) != len(polygons) else longest_list(_name_, i) name = clean_and_id_ep_string(display_name) # get the properties for the transformer props = longest_list(_properties, i) if isinstance(props, str): props = transformer_prop_by_identifier(props) # create the Transformer trans = Transformer(name, geo, props) trans.display_name = display_name transformer.append(trans)