-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(foundations): Add new Foundation components
- Support custom foundation attributes - Update installer version
- Loading branch information
Showing
10 changed files
with
479 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# | ||
# Honeybee-PH: A Plugin for adding Passive-House data to LadybugTools Honeybee-Energy Models | ||
# | ||
# This component is part of the PH-Tools toolkit <https://github.com/PH-Tools>. | ||
# | ||
# Copyright (c) 2022, PH-Tools and bldgtyp, llc <[email protected]> | ||
# Honeybee-PH is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published | ||
# by the Free Software Foundation; either version 3 of the License, | ||
# or (at your option) any later version. | ||
# | ||
# Honeybee-PH is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# For a copy of the GNU General Public License | ||
# see <https://github.com/PH-Tools/honeybee_ph/blob/main/LICENSE>. | ||
# | ||
# @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> | ||
# | ||
""" | ||
Add PH-Foundation objects to the Honeybee-Rooms. Note that | ||
PHPP only allows 3 different Foundation types per Building-Segment. | ||
- | ||
EM March 18, 2023 | ||
Args: | ||
_ph_foundation: One or more PH-Foundation Objects that you would like | ||
to add to each of the Honyebee-Rooms input. | ||
_hb_rooms: List[room.Room] One or more Honeybee-Rooms you would like to | ||
add the new PH-Foundations to. | ||
Returns: | ||
hb_rooms_: The honeyee-Rooms with building-segment information added. | ||
""" | ||
|
||
import scriptcontext as sc | ||
import Rhino as rh | ||
import rhinoscriptsyntax as rs | ||
import ghpythonlib.components as ghc | ||
import Grasshopper as gh | ||
|
||
|
||
try: | ||
from honeybee_ph_rhino import gh_compo_io, gh_io | ||
except ImportError as e: | ||
raise ImportError('Failed to import honeybee_ph_rhino:\t{}'.format(e)) | ||
|
||
|
||
# ------------------------------------------------------------------------------------- | ||
import honeybee_ph_rhino._component_info_ | ||
reload(honeybee_ph_rhino._component_info_) | ||
ghenv.Component.Name = "HBPH - Add Foundations" | ||
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev=False) | ||
if DEV: | ||
from honeybee_ph_rhino.gh_compo_io import foundations_add as gh_compo_io | ||
reload(gh_compo_io) | ||
|
||
# ------------------------------------------------------------------------------------- | ||
# -- GH Interface | ||
IGH = gh_io.IGH( ghdoc, ghenv, sc, rh, rs, ghc, gh ) | ||
|
||
|
||
# ------------------------------------------------------------------------------------- | ||
gh_compo_interface = gh_compo_io.GHCompo_AddFoundations( | ||
IGH, | ||
_ph_foundations, | ||
_hb_rooms, | ||
) | ||
hb_rooms_ = gh_compo_interface.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# | ||
# Honeybee-PH: A Plugin for adding Passive-House data to LadybugTools Honeybee-Energy Models | ||
# | ||
# This component is part of the PH-Tools toolkit <https://github.com/PH-Tools>. | ||
# | ||
# Copyright (c) 2022, PH-Tools and bldgtyp, llc <[email protected]> | ||
# Honeybee-PH is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published | ||
# by the Free Software Foundation; either version 3 of the License, | ||
# or (at your option) any later version. | ||
# | ||
# Honeybee-PH is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# For a copy of the GNU General Public License | ||
# see <https://github.com/PH-Tools/honeybee_ph/blob/main/LICENSE>. | ||
# | ||
# @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+> | ||
# | ||
""" | ||
Create a new PH-Foundation object which can be added to one or more Honeybee-Rooms. | ||
- | ||
EM March 18, 2023 | ||
Args: | ||
_type: (str) The Type of foundation. Input either- | ||
"1-Heated Basement" | ||
"2-Unheated Basement" | ||
"3-Slab on Grade" | ||
"4-Vented Crawlspace" | ||
"5-None" | ||
Returns: | ||
ph_foundation: The new PH-Foundation object which can be added to one | ||
or more Honeybee-Rooms using the "HBPH - Add Foundations" component. | ||
""" | ||
|
||
import scriptcontext as sc | ||
import Rhino as rh | ||
import rhinoscriptsyntax as rs | ||
import ghpythonlib.components as ghc | ||
import Grasshopper as gh | ||
|
||
|
||
try: | ||
from honeybee_ph_utils import preview | ||
except ImportError as e: | ||
raise ImportError('Failed to import honeybee_ph_utils:\t{}'.format(e)) | ||
|
||
try: | ||
from honeybee_ph_rhino import gh_compo_io, gh_io | ||
from honeybee_ph_rhino.gh_compo_io.foundations_create import get_component_inputs | ||
except ImportError as e: | ||
raise ImportError('Failed to import honeybee_ph_rhino:\t{}'.format(e)) | ||
|
||
|
||
# ------------------------------------------------------------------------------------- | ||
import honeybee_ph_rhino._component_info_ | ||
reload(honeybee_ph_rhino._component_info_) | ||
ghenv.Component.Name = "HBPH - Create Foundation" | ||
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev=False) | ||
if DEV: | ||
from honeybee_ph import foundations | ||
reload(foundations) | ||
from honeybee_ph_rhino.gh_compo_io import foundations_create as gh_compo_io | ||
reload(gh_compo_io) | ||
|
||
|
||
# ------------------------------------------------------------------------------------- | ||
# -- GH Interface | ||
IGH = gh_io.IGH( ghdoc, ghenv, sc, rh, rs, ghc, gh ) | ||
|
||
|
||
#------------------------------------------------------------------------------- | ||
# -- Setup the input nodes, get all the user input values | ||
input_dict = get_component_inputs(_type) | ||
gh_io.setup_component_inputs(IGH, input_dict, _start_i=2) | ||
input_values_dict = gh_io.get_component_input_values(ghenv) | ||
|
||
|
||
# ------------------------------------------------------------------------------------- | ||
gh_compo_interface = gh_compo_io.GHCompo_CreateFoundations( | ||
IGH, | ||
_type, | ||
input_values_dict, | ||
) | ||
ph_foundation_ = gh_compo_interface.run() | ||
|
||
|
||
# ------------------------------------------------------------------------------------- | ||
preview.object_preview(ph_foundation_) |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
# -*- Python Version: 2.7 -*- | ||
|
||
"""GHCompo Interface: HBPH - Add Foundations.""" | ||
|
||
try: | ||
from typing import List | ||
except ImportError: | ||
pass # IronPython 2.7 | ||
|
||
try: | ||
from honeybee_ph_rhino import gh_io | ||
except ImportError as e: | ||
raise ImportError('\nFailed to import honeybee_ph_rhino:\n\t{}'.format(e)) | ||
|
||
try: | ||
from honeybee import room | ||
except ImportError as e: | ||
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e)) | ||
|
||
try: | ||
from honeybee_ph.foundations import PhFoundation | ||
except ImportError as e: | ||
raise ImportError('\nFailed to import honeybee_ph:\n\t{}'.format(e)) | ||
|
||
|
||
class GHCompo_AddFoundations(object): | ||
|
||
def __init__(self, _IGH, _foundations, _hb_rooms): | ||
# type: (gh_io.IGH, List[PhFoundation], List[room.Room]) -> None | ||
self.IGH = _IGH | ||
self.foundations = _foundations | ||
self.hb_rooms = _hb_rooms | ||
|
||
def run(self): | ||
# type: () -> List[room.Room] | ||
hb_rooms_ = [] | ||
for hb_room in self.hb_rooms: | ||
new_hb_room = hb_room.duplicate() | ||
|
||
for ph_foundation in self.foundations: | ||
new_hb_room.properties.ph.add_foundation(ph_foundation) | ||
|
||
hb_rooms_.append(new_hb_room) | ||
|
||
return hb_rooms_ |
Oops, something went wrong.