Skip to content

Commit

Permalink
feat(foundations): Add new Foundation components
Browse files Browse the repository at this point in the history
- Support custom foundation attributes
- Update installer version
  • Loading branch information
ed-p-may authored Mar 18, 2023
2 parents e551521 + fbee38f commit d3f834e
Show file tree
Hide file tree
Showing 10 changed files with 479 additions and 8 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ Honeybee-PH plugins and components for Rhino / Grasshopper.

<img width="978" alt="image" src="https://user-images.githubusercontent.com/69652712/193476135-cfe77702-21e1-4e5e-905e-98191ce5c3e3.png">

This repository contains all PH (Passive House) modeling Grasshopper components for the Honeybee-PH
plugin. The package includes both the userobjects (`.ghuser`) and the Python
source (`.py`). Note that this library only possesses the Grasshopper components
and. On order to run the plugin the core Honeybee AND Honeybee-PH / PHX libraries must be installed in a way that
they can be found by Rhino (see dependencies and install instructions below).
This repository contains all PH (Passive House) modeling Grasshopper components for the Honeybee-PH plugin. Once installed, these new Grasshopper components will allow you to add detailed 'Passive House' style data to your Honeybee models, and to export the Honeybee models to both the Passive House Planning Package (PHPP) and WUFI-Passive. The package includes both the userobjects (`.ghuser`) and the Python source (`.py`). Note that this library only possesses the Grasshopper components. In order to use the plugin the core Honeybee, Honeybee-PH and PHX libraries must also be installed in a way that they can be found by Rhino (see dependencies and install instructions below).

More information, examples and tutorials can be found on the [Honeybee-PH](https://ph-tools.github.io/honeybee_grasshopper_ph/) page.
More information, examples, and tutorials can be found on the [Honeybee-PH](https://ph-tools.github.io/honeybee_grasshopper_ph/) page.

# How To Install honeybee-grasshoper-ph:
See the [Honeybee-PH Installation](https://ph-tools.github.io/honeybee_grasshopper_ph/install/) page for more information on how to add this package to your system.
Expand All @@ -19,7 +15,7 @@ Check out the [detailed installation walkthrough on YouTube](https://youtu.be/Dv

## Dependencies

The honeybee-grasshopper-ph plugin has the following dependencies on core libraries:
The honeybee-grasshopper-ph plugin has the following package dependencies:

* [ladybug-core](https://github.com/ladybug-tools/ladybug)
* [ladybug-geometry](https://github.com/ladybug-tools/ladybug-geometry)
Expand Down
Binary file modified hbph_installer.gh
Binary file not shown.
71 changes: 71 additions & 0 deletions honeybee_grasshopper_ph/src/HBPH - Add Foundations.py
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()
92 changes: 92 additions & 0 deletions honeybee_grasshopper_ph/src/HBPH - Create Foundation.py
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.
15 changes: 14 additions & 1 deletion honeybee_ph_rhino/_component_info_.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
These are called when the component is instantiated within the Grasshopper canvas.
"""

RELEASE_VERSION = "Honeybee-PH v1.0.24"
RELEASE_VERSION = "Honeybee-PH v1.0.25"
CATEGORY = "HB-PH"
SUB_CATEGORIES = {
0: "00 | Utils",
Expand Down Expand Up @@ -387,6 +387,19 @@
"Category": CATEGORY,
"SubCategory": 4,
},
# -- Foundations
"HBPH - Add Foundations": {
"NickName": "Add Foundations",
"Message": RELEASE_VERSION,
"Category": CATEGORY,
"SubCategory": 4,
},
"HBPH - Create Foundation": {
"NickName": "Create Foundation",
"Message": RELEASE_VERSION,
"Category": CATEGORY,
"SubCategory": 4,
},
}


Expand Down
3 changes: 3 additions & 0 deletions honeybee_ph_rhino/gh_compo_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@
# -- Export
from honeybee_ph_rhino.gh_compo_io.write_wuif_xml import GHCompo_WriteWufiXml
from honeybee_ph_rhino.gh_compo_io.write_PHPP import GHCompo_WriteToPHPP
# -- Foundations
from honeybee_ph_rhino.gh_compo_io.foundations_add import GHCompo_AddFoundations
from honeybee_ph_rhino.gh_compo_io.foundations_create import GHCompo_CreateFoundations
46 changes: 46 additions & 0 deletions honeybee_ph_rhino/gh_compo_io/foundations_add.py
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_
Loading

0 comments on commit d3f834e

Please sign in to comment.