Skip to content

Commit

Permalink
feat(collections): Add new GH Collection Components
Browse files Browse the repository at this point in the history
- Add Custom Collection Components
- Add Air-Layer HB Material Component
- Add 'Get Material' Component
- Add Import from Flixo Component
- Add Construction-from-JSON component
  • Loading branch information
ed-p-may committed Apr 1, 2023
1 parent 0f10378 commit eedfcd6
Show file tree
Hide file tree
Showing 21 changed files with 1,007 additions and 2 deletions.
81 changes: 81 additions & 0 deletions honeybee_grasshopper_ph/src/HBPH - Calc Air Layer HB Material.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#
# 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 Honeybee-Energy "Air-Layer" material. This calculator will
determine an equivalent conductivity based on the parameters input. The
procedue implemented here follows the PHPP v9/10 which closely matches the
ISO-6946-2017, Appendix D method. This material can be used in Honeybee
Constructions to approiximate the insulating effect of closed air-layers
such as service caviies.
-
Note: This "Air-Layer" is only suitable for CLOSED air layers which
are have a length AND width at least 10x the thickness, and which have less
thank 5 deg-K temperature change accross the layer.
-
EM April 1, 2023
Args:
_heat_flow_direction: Input either -
"1-Upwards"
"2-Horizontal"
"3-Downwards"
_thickness: (mm) The thickness of the Air Layer
_srfc_1_emissivity: (%) Default=0.9
_srfc_2_emissivity: (%) Default=0.9
Returns:
marterial_: The new Honeybee-Energy Material.
"""

import scriptcontext as sc
import Rhino as rh
import rhinoscriptsyntax as rs
import ghpythonlib.components as ghc
import Grasshopper as gh

from honeybee_ph_rhino import gh_compo_io, gh_io

# ------------------------------------------------------------------------------
import honeybee_ph_rhino._component_info_
reload(honeybee_ph_rhino._component_info_)
ghenv.Component.Name = "HBPH - Calc Air Layer HB Material"
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev=False)
if DEV:
from honeybee_ph_rhino.gh_compo_io import assmbly_create_air_layer_mat 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_AirLayerMaterial(
IGH,
_display_name,
_heat_flow_direction,
_thickness,
_srfc_1_emissivity,
_srfc_1_emissivity
)
material_ = gh_compo_interface.run()
74 changes: 74 additions & 0 deletions honeybee_grasshopper_ph/src/HBPH - Create Custom Collection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#
# 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 custom "Collection" of items. This collection works just like
a normal python 'Dictionary' and allows for item set and get using the typical
square bracket notation (ie: collection["my_key"] = my_value, etc.)
If provided, the collection will use the "_key_name" as the dictionary "key",
for all items and if left blank will use the items 'id()' as the key
-
EM April 1, 2023
Args:
_name: (str) An optional display_name for the collection.
_key_name: (str): Default='id(item)'. Provide the name of the item's
'key' atribute you would like to use when storing the item
to a dictionary. Be sure all items have this attribute.
_items: (Collection) An iterable collection of items you would
like to add to the new CustomCollection object.
Returns:
collection_: The new CustomCollection object with the items stored
according to their 'key' (or 'id' by default).
"""

import scriptcontext as sc
import Rhino as rh
import rhinoscriptsyntax as rs
import ghpythonlib.components as ghc
import Grasshopper as gh

from honeybee_ph_rhino import gh_compo_io, gh_io

# ------------------------------------------------------------------------------
import honeybee_ph_rhino._component_info_
reload(honeybee_ph_rhino._component_info_)
ghenv.Component.Name = "HBPH - Create Custom Collection"
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev=False)
if DEV:
from honeybee_ph_rhino.gh_compo_io import util_create_collection 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_CreateCustomCollection(
IGH,
_name,
_key_name,
_items,
)
collection_ = gh_compo_interface.run()
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#
# 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 new Honeybee-Energy Constructions based on a JSON file and a set of
Honeybee-Energy Materials. Note that the input JSON describing the construction
should be a normal HB JSON, except that this component also allows for an optional
"thickness" attribute which will set the thickness of each material layer as
the new construction is built. For example -
"W1 - Below Grade Conc. Wall": {
"type": "OpaqueConstructionAbridged",
"identifier": "W1 - Below Grade Conc. Wall",
"materials": ["Concrete (Heavily Reinforced) [R-0.05/in]", "XPS [R-5.0/in]"],
"thicknesses": ["8in", "6in"]
}
Will create a new construction and set the thicknesses of the layers as indicated (8in, then 6in).
-
EM April 1, 2023
Args:
_materials (List[EnergyMaterials]): A list of the Honeybee-Energy materials
that you would like to use to create the Honeybee Constructions.
_path: (str) The path (or paths) to the .JSON file which describes the
Honeybee-Constructions.
Returns:
constructions_: The new Honeybee-Energy Constructions, built from the
Honeybee-Energy Materials input.
"""

import scriptcontext as sc
import Rhino as rh
import rhinoscriptsyntax as rs
import ghpythonlib.components as ghc
import Grasshopper as gh

from honeybee_ph_rhino import gh_compo_io, gh_io

# ------------------------------------------------------------------------------
import honeybee_ph_rhino._component_info_
reload(honeybee_ph_rhino._component_info_)
ghenv.Component.Name = "HBPH - Create Detailed Constructions"
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev=False)
if DEV:
from honeybee_ph_rhino.gh_compo_io import assmbly_create_detailed_const 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_CreateDetailedConstructions(
IGH,
_path,
_materials,
)
constructions_ = gh_compo_interface.run()
64 changes: 64 additions & 0 deletions honeybee_grasshopper_ph/src/HBPH - Get Brep Subface Materials.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#
# 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+>
#
"""
Get all of the Rhino Material Names for the subfaces of a closed Brep. This is
useful wheh using Materials as the 'key' for assigning things like constructions,
boundary-conditions or other sub-face specific values.
-
EM April 1, 2023
Args:
_breps: (List[Guid]) A List of Brep Guid values.
Returns:
subface_geometry_: The subface surfaces of the input Brep.
material_names_: The names of the Materials assigned to the
subface surfaces of the input Breps.
"""

import scriptcontext as sc
import Rhino as rh
import rhinoscriptsyntax as rs
import ghpythonlib.components as ghc
import Grasshopper as gh

from honeybee_ph_rhino import gh_compo_io, gh_io

# ------------------------------------------------------------------------------
import honeybee_ph_rhino._component_info_
reload(honeybee_ph_rhino._component_info_)
ghenv.Component.Name = "HBPH - Get Brep Subface Materials"
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev=False)
if DEV:
from honeybee_ph_rhino.gh_compo_io import util_get_brep_subface_mats 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_GetSubFaceMaterials(
IGH,
_breps
)
subface_geometry_, material_names_ = gh_compo_interface.run()
64 changes: 64 additions & 0 deletions honeybee_grasshopper_ph/src/HBPH - Get From Custom Collection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#
# 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+>
#
"""
Get all of the Rhino Material Names for the subfaces of a closed Brep. This is
useful wheh using Materials as the 'key' for assigning things like constructions,
boundary-conditions or other sub-face specific values.
-
EM April 1, 2023
Args:
_collection: (List[Guid]) A CustomCollection to get items from.
_keys: (List[str]) A list of the keys to 'get' from the collection
Returns:
values_: The items found, or None if not found.
"""

import scriptcontext as sc
import Rhino as rh
import rhinoscriptsyntax as rs
import ghpythonlib.components as ghc
import Grasshopper as gh

from honeybee_ph_rhino import gh_compo_io, gh_io

# ------------------------------------------------------------------------------
import honeybee_ph_rhino._component_info_
reload(honeybee_ph_rhino._component_info_)
ghenv.Component.Name = "HBPH - Get From Custom Collection"
DEV = honeybee_ph_rhino._component_info_.set_component_params(ghenv, dev=False)
if DEV:
from honeybee_ph_rhino.gh_compo_io import util_get_from_collection 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_GetFromCustomCollection(
IGH,
_collection,
_keys,
)
values_ = gh_compo_interface.run()
Loading

0 comments on commit eedfcd6

Please sign in to comment.