honeybee-grasshopper-radiance 1.35.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- honeybee_grasshopper_radiance/__init__.py +7 -0
- honeybee_grasshopper_radiance/src/HB Adjust HDR.py +107 -0
- honeybee_grasshopper_radiance/src/HB Ambient Resolution.py +63 -0
- honeybee_grasshopper_radiance/src/HB Annual Average Values.py +205 -0
- honeybee_grasshopper_radiance/src/HB Annual Cumulative Values.py +191 -0
- honeybee_grasshopper_radiance/src/HB Annual Daylight Metrics.py +209 -0
- honeybee_grasshopper_radiance/src/HB Annual Daylight.py +153 -0
- honeybee_grasshopper_radiance/src/HB Annual Glare Metrics.py +137 -0
- honeybee_grasshopper_radiance/src/HB Annual Irradiance.py +112 -0
- honeybee_grasshopper_radiance/src/HB Annual Peak Values.py +224 -0
- honeybee_grasshopper_radiance/src/HB Annual Results to Data.py +246 -0
- honeybee_grasshopper_radiance/src/HB Annual Sunlight Exposure.py +147 -0
- honeybee_grasshopper_radiance/src/HB Aperture Group Schedule.py +69 -0
- honeybee_grasshopper_radiance/src/HB Apply Face Modifier.py +107 -0
- honeybee_grasshopper_radiance/src/HB Apply ModifierSet.py +71 -0
- honeybee_grasshopper_radiance/src/HB Apply Shade Modifier.py +110 -0
- honeybee_grasshopper_radiance/src/HB Apply Window Modifier.py +120 -0
- honeybee_grasshopper_radiance/src/HB Assign Grids and Views.py +58 -0
- honeybee_grasshopper_radiance/src/HB Automatic Aperture Group.py +100 -0
- honeybee_grasshopper_radiance/src/HB BSDF Modifier.py +78 -0
- honeybee_grasshopper_radiance/src/HB CIE Standard Sky.py +75 -0
- honeybee_grasshopper_radiance/src/HB Certain Illuminance.py +41 -0
- honeybee_grasshopper_radiance/src/HB Check Scene.py +208 -0
- honeybee_grasshopper_radiance/src/HB Climatebased Sky.py +75 -0
- honeybee_grasshopper_radiance/src/HB Cumulative Radiation.py +98 -0
- honeybee_grasshopper_radiance/src/HB Custom Sky.py +74 -0
- honeybee_grasshopper_radiance/src/HB Daylight Control Schedule.py +211 -0
- honeybee_grasshopper_radiance/src/HB Daylight Factor.py +82 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct Modifier.py +47 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct ModifierSet Interior.py +67 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct ModifierSet.py +80 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct Wea.py +44 -0
- honeybee_grasshopper_radiance/src/HB Direct Sun Hours.py +88 -0
- honeybee_grasshopper_radiance/src/HB Dynamic Aperture Group.py +90 -0
- honeybee_grasshopper_radiance/src/HB Dynamic Shade Group.py +95 -0
- honeybee_grasshopper_radiance/src/HB Dynamic State Geometry.py +68 -0
- honeybee_grasshopper_radiance/src/HB Dynamic State.py +44 -0
- honeybee_grasshopper_radiance/src/HB Exterior Modifier Subset.py +68 -0
- honeybee_grasshopper_radiance/src/HB Extract HDR.py +225 -0
- honeybee_grasshopper_radiance/src/HB False Color.py +246 -0
- honeybee_grasshopper_radiance/src/HB Get Dynamic Groups.py +57 -0
- honeybee_grasshopper_radiance/src/HB Get Grids and Views.py +82 -0
- honeybee_grasshopper_radiance/src/HB Glare Postprocess.py +225 -0
- honeybee_grasshopper_radiance/src/HB Glass Modifier 3.py +62 -0
- honeybee_grasshopper_radiance/src/HB Glass Modifier.py +58 -0
- honeybee_grasshopper_radiance/src/HB HDR to GIF.py +72 -0
- honeybee_grasshopper_radiance/src/HB Imageless Annual Glare.py +108 -0
- honeybee_grasshopper_radiance/src/HB Interior Modifier Subset.py +83 -0
- honeybee_grasshopper_radiance/src/HB Metal Modifier 3.py +70 -0
- honeybee_grasshopper_radiance/src/HB Metal Modifier.py +68 -0
- honeybee_grasshopper_radiance/src/HB Mirror Modifier 3.py +56 -0
- honeybee_grasshopper_radiance/src/HB Mirror Modifier.py +55 -0
- honeybee_grasshopper_radiance/src/HB Model to Rad Folder.py +75 -0
- honeybee_grasshopper_radiance/src/HB ModifierSet.py +127 -0
- honeybee_grasshopper_radiance/src/HB Opaque Modifier 3.py +68 -0
- honeybee_grasshopper_radiance/src/HB Opaque Modifier.py +67 -0
- honeybee_grasshopper_radiance/src/HB Point-In-Time Grid-Based.py +93 -0
- honeybee_grasshopper_radiance/src/HB Point-In-Time View-Based.py +127 -0
- honeybee_grasshopper_radiance/src/HB Radial Grid from Rooms.py +160 -0
- honeybee_grasshopper_radiance/src/HB Radial Sensor Grid.py +99 -0
- honeybee_grasshopper_radiance/src/HB Radiance Parameter.py +163 -0
- honeybee_grasshopper_radiance/src/HB Search Modifier Sets.py +58 -0
- honeybee_grasshopper_radiance/src/HB Search Modifiers.py +58 -0
- honeybee_grasshopper_radiance/src/HB Section Plane View.py +69 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid from Apertures.py +153 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid from Faces.py +147 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid from Rooms.py +210 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid.py +82 -0
- honeybee_grasshopper_radiance/src/HB Shade Modifier Subset.py +62 -0
- honeybee_grasshopper_radiance/src/HB Sky View.py +86 -0
- honeybee_grasshopper_radiance/src/HB Spatial Daylight Autonomy.py +86 -0
- honeybee_grasshopper_radiance/src/HB Subface Modifier Subset.py +90 -0
- honeybee_grasshopper_radiance/src/HB Translucent Modifier 3.py +77 -0
- honeybee_grasshopper_radiance/src/HB Translucent Modifier.py +77 -0
- honeybee_grasshopper_radiance/src/HB View from Viewport.py +85 -0
- honeybee_grasshopper_radiance/src/HB View.py +96 -0
- honeybee_grasshopper_radiance/src/HB Visualize Sky.py +141 -0
- honeybee_grasshopper_radiance/src/HB Wea From Clear Sky.py +61 -0
- honeybee_grasshopper_radiance/src/HB Wea From EPW.py +50 -0
- honeybee_grasshopper_radiance/src/HB Wea From Tau Clear Sky.py +56 -0
- honeybee_grasshopper_radiance/src/HB Wea from Zhang-Huang.py +63 -0
- honeybee_grasshopper_radiance/src/__init__.py +1 -0
- honeybee_grasshopper_radiance/user_objects/HB Adjust HDR.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Ambient Resolution.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Average Values.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Cumulative Values.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Daylight Metrics.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Daylight.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Glare Metrics.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Irradiance.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Peak Values.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Results to Data.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Sunlight Exposure.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Aperture Group Schedule.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply Face Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply ModifierSet.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply Shade Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply Window Modifier.ghuser +0 -0
- Views.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Automatic Aperture Group.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB BSDF Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB CIE Standard Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Certain Illuminance.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Check Scene.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Climatebased Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Cumulative Radiation.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Custom Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Daylight Control Schedule.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Daylight Factor.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct ModifierSet Interior.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct ModifierSet.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct Wea.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Direct Sun Hours.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic Aperture Group.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic Shade Group.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic State Geometry.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic State.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Exterior Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Extract HDR.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Face Radiance Attributes.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB False Color.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Get Dynamic Groups.ghuser +0 -0
- Views.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Glare Postprocess.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Glass Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Glass Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB HDR to GIF.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Imageless Annual Glare.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Interior Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Metal Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Metal Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Mirror Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Mirror Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Model to Rad Folder.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB ModifierSet.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Opaque Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Opaque Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Point-In-Time Grid-Based.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Point-In-Time View-Based.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Radial Grid from Rooms.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Radial Sensor Grid.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Radiance Parameter.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Room Radiance Attributes.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Search Modifier Sets.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Search Modifiers.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Section Plane View.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Apertures.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Faces.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Rooms.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Shade Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sky View.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Spatial Daylight Autonomy.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Subface Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Translucent Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Translucent Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB View from Viewport.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB View.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Visualize Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea From Clear Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea From EPW.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea From Tau Clear Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea from Zhang-Huang.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/__init__.py +1 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/METADATA +64 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/RECORD +170 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/WHEEL +5 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/licenses/LICENSE +661 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL)
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
5
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
6
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
7
|
+
#
|
|
8
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Combine Honeybee Apertures into a single dynamic group. Apertures that are a part
|
|
12
|
+
of the same dynamic group will have their states change in unison. If an aperture
|
|
13
|
+
has no dynamic group, it is assumed to be static.
|
|
14
|
+
-
|
|
15
|
+
This component can also be used to combine apertures that already have states
|
|
16
|
+
assigned to them into one group since existing states are not overwritten if
|
|
17
|
+
nothing is connected to states_. In this case, the total number of states in
|
|
18
|
+
the dynamic group is equal to that of the object with the highest number of
|
|
19
|
+
states. After a dynamic aperture with fewer states than that of it's dynamic
|
|
20
|
+
group has hit its highest state, it remains in that state as the other dynamic
|
|
21
|
+
apertures continue to change.
|
|
22
|
+
-
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
_apertures: A list of Honeybee Apertures to be grouped together into a
|
|
26
|
+
single dynamic group. Door objects can also be connected here to be
|
|
27
|
+
included in the group.
|
|
28
|
+
_name_: Text to be incorporated into a unique identifier for the dynamic
|
|
29
|
+
Aperture group. If the name is not provided, a random name will be assigned.
|
|
30
|
+
states_: An optional list of Honeybee State objects ordered based on
|
|
31
|
+
how they will be switched on. The first state is the default state
|
|
32
|
+
and, typically, higher states are more shaded. If the objects in the
|
|
33
|
+
group have no states, the modifiers already assigned the apertures
|
|
34
|
+
will be used for all states.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
group_aps: Honeybee apertures that are a part of the same dynamic group.
|
|
38
|
+
These can be used directly in radiance simulations or can be added
|
|
39
|
+
to Honeybee faces and rooms.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
ghenv.Component.Name = 'HB Dynamic Aperture Group'
|
|
43
|
+
ghenv.Component.NickName = 'ApertureGroup'
|
|
44
|
+
ghenv.Component.Message = '1.9.0'
|
|
45
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
46
|
+
ghenv.Component.SubCategory = '0 :: Basic Properties'
|
|
47
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '2'
|
|
48
|
+
|
|
49
|
+
import uuid
|
|
50
|
+
|
|
51
|
+
try: # import the core honeybee dependencies
|
|
52
|
+
from honeybee.aperture import Aperture
|
|
53
|
+
from honeybee.door import Door
|
|
54
|
+
from honeybee.typing import clean_and_id_rad_string, clean_rad_string
|
|
55
|
+
except ImportError as e:
|
|
56
|
+
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))
|
|
57
|
+
|
|
58
|
+
try: # import the ladybug_rhino dependencies
|
|
59
|
+
from ladybug_rhino.grasshopper import all_required_inputs
|
|
60
|
+
except ImportError as e:
|
|
61
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if all_required_inputs(ghenv.Component):
|
|
65
|
+
# check and duplicate the input objects
|
|
66
|
+
group_aps = []
|
|
67
|
+
for ap in _apertures:
|
|
68
|
+
assert isinstance(ap, (Aperture, Door)), 'Expected Aperture or Door ' \
|
|
69
|
+
'for dynamic group. Got {}.'.format(type(ap))
|
|
70
|
+
group_aps.append(ap.duplicate())
|
|
71
|
+
|
|
72
|
+
# set the name of the dynamic group
|
|
73
|
+
name = clean_and_id_rad_string('ApertureGroup') if _name_ is None else clean_rad_string(_name_)
|
|
74
|
+
for ap in group_aps:
|
|
75
|
+
ap.properties.radiance.dynamic_group_identifier = name
|
|
76
|
+
|
|
77
|
+
# assign any states if they are connected
|
|
78
|
+
if len(states_) != 0:
|
|
79
|
+
# assign states (including shades) to the first aperture
|
|
80
|
+
group_aps[0].properties.radiance.states = [state.duplicate() for state in states_]
|
|
81
|
+
|
|
82
|
+
# remove shades from following apertures to ensure they aren't double-counted
|
|
83
|
+
states_wo_shades = []
|
|
84
|
+
for state in states_:
|
|
85
|
+
new_state = state.duplicate()
|
|
86
|
+
new_state.remove_shades()
|
|
87
|
+
states_wo_shades.append(new_state)
|
|
88
|
+
for ap in group_aps[1:]:
|
|
89
|
+
ap.properties.radiance.states = \
|
|
90
|
+
[state.duplicate() for state in states_wo_shades]
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL)
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
5
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
6
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
7
|
+
#
|
|
8
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Combine Honeybee Shades into a single dynamic group. Shades that are a part
|
|
12
|
+
of the same dynamic group will have their states change in unison. If an shade
|
|
13
|
+
has no dynamic group, it is assumed to be static.
|
|
14
|
+
-
|
|
15
|
+
This component can also be used to combine shades that already have states
|
|
16
|
+
assigned to them into one group since existing states are not overwritten if
|
|
17
|
+
nothing is connected to states_. In this case, the total number of states in
|
|
18
|
+
the dynamic group is equal to that of the object with the highest number of
|
|
19
|
+
states. After a dynamic shade with fewer states than that of it's dynamic
|
|
20
|
+
group has hit its highest state, it remains in that state as the other dynamic
|
|
21
|
+
shades continue to change.
|
|
22
|
+
-
|
|
23
|
+
|
|
24
|
+
Args:
|
|
25
|
+
_shades: A list of Honeybee Shades to be grouped together into a
|
|
26
|
+
single dynamic group.
|
|
27
|
+
_name_: Text to be incorporated into a unique identifier for the dynamic
|
|
28
|
+
Shade group. If the name is not provided, a random name will be assigned.
|
|
29
|
+
states_: An optional list of Honeybee State objects ordered based on
|
|
30
|
+
how they will be switched on. The first state is the default state
|
|
31
|
+
and, typically, higher states are more shaded. If the objects in the
|
|
32
|
+
group have no states, the modifiers already assigned the shades
|
|
33
|
+
will be used for all states.
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
group_shds: Honeybee shades that are a part of the same dynamic group.
|
|
37
|
+
These can be used directly in radiance simulations or can be added
|
|
38
|
+
to Honeybee faces and rooms.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
ghenv.Component.Name = 'HB Dynamic Shade Group'
|
|
42
|
+
ghenv.Component.NickName = 'ShadeGroup'
|
|
43
|
+
ghenv.Component.Message = '1.9.0'
|
|
44
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
45
|
+
ghenv.Component.SubCategory = '0 :: Basic Properties'
|
|
46
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '0'
|
|
47
|
+
|
|
48
|
+
import uuid
|
|
49
|
+
|
|
50
|
+
try: # import the core honeybee dependencies
|
|
51
|
+
from honeybee.shade import Shade
|
|
52
|
+
from honeybee.typing import clean_and_id_rad_string, clean_rad_string
|
|
53
|
+
except ImportError as e:
|
|
54
|
+
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))
|
|
55
|
+
|
|
56
|
+
try: # import the honeybee-radiance dependencies
|
|
57
|
+
from honeybee_radiance.dynamic import RadianceShadeState
|
|
58
|
+
except ImportError as e:
|
|
59
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
60
|
+
|
|
61
|
+
try: # import the ladybug_rhino dependencies
|
|
62
|
+
from ladybug_rhino.grasshopper import all_required_inputs
|
|
63
|
+
except ImportError as e:
|
|
64
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if all_required_inputs(ghenv.Component):
|
|
68
|
+
# check and duplicate the input objects
|
|
69
|
+
group_shds = []
|
|
70
|
+
for shd in _shades:
|
|
71
|
+
assert isinstance(shd, Shade), 'Expected Shade ' \
|
|
72
|
+
'for dynamic shade group. Got {}.'.format(type(shd))
|
|
73
|
+
group_shds.append(shd.duplicate())
|
|
74
|
+
|
|
75
|
+
# set the name of the dynamic group
|
|
76
|
+
name = clean_and_id_rad_string('ShadeGroup') if _name_ is None else clean_rad_string(_name_)
|
|
77
|
+
for shd in group_shds:
|
|
78
|
+
shd.properties.radiance.dynamic_group_identifier = name
|
|
79
|
+
|
|
80
|
+
# assign any states if they are connected
|
|
81
|
+
if len(states_) != 0:
|
|
82
|
+
# convert the sub-face states to shade states
|
|
83
|
+
shd_states = [RadianceShadeState(st.modifier, st.shades) for st in states_]
|
|
84
|
+
# assign states (including shades) to the first shade
|
|
85
|
+
group_shds[0].properties.radiance.states = [state.duplicate() for state in shd_states]
|
|
86
|
+
|
|
87
|
+
# remove shades from following shades to ensure they aren't double-counted
|
|
88
|
+
states_wo_shades = []
|
|
89
|
+
for state in shd_states:
|
|
90
|
+
new_state = state.duplicate()
|
|
91
|
+
new_state.remove_shades()
|
|
92
|
+
states_wo_shades.append(new_state)
|
|
93
|
+
for shd in group_shds[1:]:
|
|
94
|
+
shd.properties.radiance.states = \
|
|
95
|
+
[state.duplicate() for state in states_wo_shades]
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
5
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
6
|
+
#
|
|
7
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Create a StateGeometry object that can be assigned to the shades_ of a dynamic
|
|
11
|
+
state using the "HB Dynamic State" component.
|
|
12
|
+
-
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
_geo: Rhino Brep or Mesh geometry to be converted to StateGeometry.
|
|
16
|
+
_name_: Text to set the name for the StateGeometry and to be incorporated into
|
|
17
|
+
unique StateGeometry identifier. If the name is not provided, a random name
|
|
18
|
+
will be assigned.
|
|
19
|
+
_modifier_: A Honeybee Radiance Modifier object for the geometry. If None,
|
|
20
|
+
it will be the Generic Exterior Shade modifier in the lib. (Default: None).
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
geo: A Honeybee StateGeometry object representing planar geometry that
|
|
24
|
+
can be assigned to Radiance states. This can be assigned using the
|
|
25
|
+
"HB Dynamic State" component.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
ghenv.Component.Name = 'HB Dynamic State Geometry'
|
|
29
|
+
ghenv.Component.NickName = 'StateGeo'
|
|
30
|
+
ghenv.Component.Message = '1.9.0'
|
|
31
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
32
|
+
ghenv.Component.SubCategory = '0 :: Basic Properties'
|
|
33
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '3'
|
|
34
|
+
|
|
35
|
+
import uuid
|
|
36
|
+
|
|
37
|
+
try: # import the core honeybee dependencies
|
|
38
|
+
from honeybee.typing import clean_and_id_rad_string, clean_rad_string
|
|
39
|
+
except ImportError as e:
|
|
40
|
+
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
from honeybee_radiance.dynamic import StateGeometry
|
|
44
|
+
except ImportError as e:
|
|
45
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
46
|
+
|
|
47
|
+
try: # import the ladybug_rhino dependencies
|
|
48
|
+
from ladybug_rhino.togeometry import to_face3d
|
|
49
|
+
from ladybug_rhino.grasshopper import all_required_inputs
|
|
50
|
+
except ImportError as e:
|
|
51
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
if all_required_inputs(ghenv.Component):
|
|
55
|
+
geo = [] # list of geometries that will be returned
|
|
56
|
+
|
|
57
|
+
# set default name
|
|
58
|
+
name = clean_and_id_rad_string('StateGeo') if _name_ is None \
|
|
59
|
+
else clean_and_id_rad_string(_name_)
|
|
60
|
+
|
|
61
|
+
# create the StateGeometry
|
|
62
|
+
i = 0 # iterator to ensure each geometry gets a unique name
|
|
63
|
+
for rh_geo in _geo:
|
|
64
|
+
for lb_face in to_face3d(rh_geo):
|
|
65
|
+
hb_geo = StateGeometry('{}_{}'.format(name, i), lb_face, _modifier_)
|
|
66
|
+
if _name_ is not None:
|
|
67
|
+
hb_geo.display_name = _name_
|
|
68
|
+
geo.append(hb_geo)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL) started by Mostapha Sadeghipour Roudsari
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
5
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
6
|
+
#
|
|
7
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Create a State object representing a single dynamic group state.
|
|
11
|
+
-
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
modifier_: A Honeybee Radiance Modifier object to be applied to this state's
|
|
15
|
+
parent in this state. This is used to swap out the modifier in
|
|
16
|
+
multi-phase studies. If None, it will be the parent's default modifier.
|
|
17
|
+
shades_: An optional array of StateGeometry objects to be included
|
|
18
|
+
with this state.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
state: A Honeybee State object representing a single dynamic group state.
|
|
22
|
+
This can be assigned to apertures or shades using the "HB Dynamic
|
|
23
|
+
Aperture Group" componet or the "HB Dynamic Shade Group" component.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
ghenv.Component.Name = 'HB Dynamic State'
|
|
27
|
+
ghenv.Component.NickName = 'State'
|
|
28
|
+
ghenv.Component.Message = '1.9.0'
|
|
29
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
30
|
+
ghenv.Component.SubCategory = '0 :: Basic Properties'
|
|
31
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '3'
|
|
32
|
+
|
|
33
|
+
try:
|
|
34
|
+
from honeybee_radiance.dynamic import RadianceSubFaceState
|
|
35
|
+
except ImportError as e:
|
|
36
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
from ladybug_rhino.grasshopper import turn_off_old_tag
|
|
40
|
+
except ImportError as e:
|
|
41
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
42
|
+
turn_off_old_tag(ghenv.Component)
|
|
43
|
+
|
|
44
|
+
state = RadianceSubFaceState(modifier_, [geo.duplicate() for geo in shades_])
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL)
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
5
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
6
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
7
|
+
#
|
|
8
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Create a list of exterior modifiers that can be used to edit or create a
|
|
12
|
+
ModifierSet object.
|
|
13
|
+
-
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
_exterior_wall_: A modifier object for exterior walls (or text for
|
|
17
|
+
the identifier of the modifier within the library).
|
|
18
|
+
_exterior_roof_: A modifier object for exterior roofs (or text for
|
|
19
|
+
the identifier of the modifier within the library).
|
|
20
|
+
_exposed_floor_: A modifier object for exposed floors (or text for
|
|
21
|
+
the identifier of the modifier within the library).
|
|
22
|
+
|
|
23
|
+
Returns:
|
|
24
|
+
exterior_set: A list of exterior modifiers that can be used to edit
|
|
25
|
+
or create a ModifierSet object.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
ghenv.Component.Name = 'HB Exterior Modifier Subset'
|
|
29
|
+
ghenv.Component.NickName = 'ExteriorSubset'
|
|
30
|
+
ghenv.Component.Message = '1.9.0'
|
|
31
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
32
|
+
ghenv.Component.SubCategory = '1 :: Modifiers'
|
|
33
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '4'
|
|
34
|
+
|
|
35
|
+
try: # import honeybee_radiance dependencies
|
|
36
|
+
from honeybee_radiance.modifier import Modifier
|
|
37
|
+
from honeybee_radiance.lib.modifiers import modifier_by_identifier
|
|
38
|
+
except ImportError as e:
|
|
39
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
from ladybug_rhino.grasshopper import turn_off_old_tag
|
|
43
|
+
except ImportError as e:
|
|
44
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
45
|
+
turn_off_old_tag(ghenv.Component)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def check_mod(mod, input_name):
|
|
49
|
+
"""Get an Modifier from the library if it's a string."""
|
|
50
|
+
if isinstance(mod, str):
|
|
51
|
+
return modifier_by_identifier(mod)
|
|
52
|
+
else:
|
|
53
|
+
assert isinstance(mod, Modifier), \
|
|
54
|
+
'Expected Modifier for {}. Got {}'.format(input_name, type(mod))
|
|
55
|
+
return mod
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# go through each input modifier
|
|
59
|
+
if _exterior_wall_ is not None:
|
|
60
|
+
_exterior_wall_ = check_mod(_exterior_wall_, '_exterior_wall_')
|
|
61
|
+
if _exterior_roof_ is not None:
|
|
62
|
+
_exterior_roof_ = check_mod(_exterior_roof_, '_exterior_roof_')
|
|
63
|
+
if _exposed_floor_ is not None:
|
|
64
|
+
_exposed_floor_ = check_mod(_exposed_floor_, '_exposed_floor_')
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
# return the final list from the component
|
|
68
|
+
exterior_set = [_exterior_wall_, _exterior_roof_, _exposed_floor_]
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL)
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
5
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
6
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
7
|
+
#
|
|
8
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Interpolate or extrapolate a High Dynamic Range (HDR) image file from another
|
|
12
|
+
HDR image file.
|
|
13
|
+
_
|
|
14
|
+
Recommended use is to extract 180 FOV (-vh 180 -vv 180) angular or hemispherical
|
|
15
|
+
HDR images from a 360 FOV (-vh 360 -vv 360) angular HDR image. Alternatively,
|
|
16
|
+
conversions between 180 FOV angular and hemispherical HDR images can be made.
|
|
17
|
+
-
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
_view: A view to interpolate or extrapolate into a new HDR. The "HB View"
|
|
21
|
+
component can be used to create an input view and it must
|
|
22
|
+
have the same position as that use to make the _hdr.
|
|
23
|
+
_hdr: Path to a High Dynamic Range (HDR) image file from which to
|
|
24
|
+
interpolate or extrapolate.
|
|
25
|
+
_resolution_: An integer for the dimension of the output image in pixels.
|
|
26
|
+
If extracting a 180 FOV angular or hemispherical HDR image from a
|
|
27
|
+
360 FOV HDR image, the default resolution is 1/3 of the resolution of
|
|
28
|
+
_hdr. If converting between 180 FOV angular or hemispherical HDR
|
|
29
|
+
images, the default resolution is that of _hdr.
|
|
30
|
+
|
|
31
|
+
Returns:
|
|
32
|
+
hdr: Path to the resulting HDR image file.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
ghenv.Component.Name = 'HB Extract HDR'
|
|
36
|
+
ghenv.Component.NickName = 'ExtractHDR'
|
|
37
|
+
ghenv.Component.Message = '1.9.0'
|
|
38
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
39
|
+
ghenv.Component.SubCategory = '4 :: Results'
|
|
40
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '0'
|
|
41
|
+
|
|
42
|
+
import os
|
|
43
|
+
import subprocess
|
|
44
|
+
import re
|
|
45
|
+
|
|
46
|
+
try: # import honeybee_radiance_command dependencies
|
|
47
|
+
from honeybee_radiance_command.pinterp import Pinterp
|
|
48
|
+
from honeybee_radiance_command.ra_xyze import Ra_xyze
|
|
49
|
+
except ImportError as e:
|
|
50
|
+
raise ImportError('\nFailed to import honeybee_radiance_command:\n\t{}'.format(e))
|
|
51
|
+
|
|
52
|
+
try: # import honeybee_radiance dependencies
|
|
53
|
+
from honeybee_radiance.config import folders as rad_folders
|
|
54
|
+
from honeybee_radiance.view import View
|
|
55
|
+
except ImportError as e:
|
|
56
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
57
|
+
|
|
58
|
+
try: # import ladybug_rhino dependencies
|
|
59
|
+
from ladybug_rhino.grasshopper import all_required_inputs, give_warning
|
|
60
|
+
except ImportError as e:
|
|
61
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
62
|
+
|
|
63
|
+
# check the Radiance date of the installed radiance
|
|
64
|
+
try: # import lbt_recipes dependencies
|
|
65
|
+
from lbt_recipes.version import check_radiance_date
|
|
66
|
+
except ImportError as e:
|
|
67
|
+
raise ImportError('\nFailed to import lbt_recipes:\n\t{}'.format(e))
|
|
68
|
+
check_radiance_date()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def check_view_hdr(hdr_path):
|
|
72
|
+
"""Check if the header of the HDR image contains a view (VIEW=).
|
|
73
|
+
|
|
74
|
+
A ValueError is raised if the image does not contain a valid view.
|
|
75
|
+
A ValueError is raised if the view type is not -vta or -vth.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
hdr_path: The path to an HDR image file.
|
|
79
|
+
"""
|
|
80
|
+
# set hdr_view to None
|
|
81
|
+
hdr_view = None
|
|
82
|
+
|
|
83
|
+
# read hdr image and search for a valid view
|
|
84
|
+
with open(hdr_path, 'r') as hdr_file:
|
|
85
|
+
for lineCount, line in enumerate(hdr_file):
|
|
86
|
+
if lineCount < 200:
|
|
87
|
+
low_line = line.lower()
|
|
88
|
+
if not low_line.startswith('\t'):
|
|
89
|
+
if low_line.startswith('view='):
|
|
90
|
+
hdr_view = View.from_string('hdr_view', line)
|
|
91
|
+
else: # no need to check the rest of the document
|
|
92
|
+
break
|
|
93
|
+
if not hdr_view:
|
|
94
|
+
raise ValueError(
|
|
95
|
+
'Connected _hdr image does not contain a valid view in the header.\n'
|
|
96
|
+
'Note that indented views in the header will be ignored by pinterp.')
|
|
97
|
+
if not hdr_view.type in ('a', 'h'):
|
|
98
|
+
msg = 'Expected view type -vta or -vth in _hdr. Got view type -vt{}.'
|
|
99
|
+
raise ValueError(msg.format(hdr_view.type))
|
|
100
|
+
return hdr_view
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def check_view_points(view, hdr_view):
|
|
104
|
+
"""Check if view points of output view and input HDR are matching.
|
|
105
|
+
|
|
106
|
+
A ValueError is raised if the view points are not matching.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
view: A Honeybee Radiance View to extract.
|
|
110
|
+
hdr_view: A Honeybee Radiance View from the input HDR.
|
|
111
|
+
"""
|
|
112
|
+
if not view.position == hdr_view.position:
|
|
113
|
+
msg = 'View points of _view and _hdr are not matching.\n' \
|
|
114
|
+
'Got _view = {} and _hdr = {}.'
|
|
115
|
+
raise ValueError(msg.format(view.position, hdr_view.position))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def check_resolution(hdr_path, resolution, view, hdr_view):
|
|
119
|
+
"""Check the resolution of the output HDR as well as the input HDR.
|
|
120
|
+
|
|
121
|
+
A warning is raised if the HDR image dimensions are not square. A warning is
|
|
122
|
+
raised if the resolution is larger than one third of the HDR image
|
|
123
|
+
resolution if converting a 360 FOV HDR to 180 FOV HDR. A warning is raised
|
|
124
|
+
if the output resolution is larger than the input resolution.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
hdr_path: The path to an HDR image file.
|
|
128
|
+
resolution: The resolution of the extracted view from hdr_path.
|
|
129
|
+
view: A Honeybee Radiance View to extract.
|
|
130
|
+
hdr_view: A Honeybee Radiance View from the input HDR.
|
|
131
|
+
"""
|
|
132
|
+
# get the path the the getinfo command
|
|
133
|
+
getinfo_exe = os.path.join(rad_folders.radbin_path, 'getinfo.exe') if \
|
|
134
|
+
os.name == 'nt' else os.path.join(rad_folders.radbin_path, 'getinfo')
|
|
135
|
+
|
|
136
|
+
# run the getinfo command in a manner that lets us obtain the result
|
|
137
|
+
cmds = [getinfo_exe, '-d', hdr_path]
|
|
138
|
+
use_shell = True if os.name == 'nt' else False
|
|
139
|
+
process = subprocess.Popen(cmds, stdout=subprocess.PIPE, shell=use_shell)
|
|
140
|
+
stdout = process.communicate()
|
|
141
|
+
img_dim = stdout[0]
|
|
142
|
+
|
|
143
|
+
def get_dimensions(img_dim):
|
|
144
|
+
dimensions = []
|
|
145
|
+
for d in ['+X', '-Y']:
|
|
146
|
+
regex = r'\%s\s+(\d+)' % d
|
|
147
|
+
matches = re.finditer(regex, img_dim, re.MULTILINE)
|
|
148
|
+
dim = next(matches).groups()[0]
|
|
149
|
+
dimensions.append(int(dim))
|
|
150
|
+
return dimensions
|
|
151
|
+
# check the X and Y dimensions of the image
|
|
152
|
+
hdr_x, hdr_y = get_dimensions(img_dim)
|
|
153
|
+
|
|
154
|
+
if hdr_x == hdr_y:
|
|
155
|
+
hdr_resolution = hdr_x = hdr_y
|
|
156
|
+
else:
|
|
157
|
+
msg = 'It is recommended that image dimensions of _hdr are square.\n' \
|
|
158
|
+
'Got {} x {}.'
|
|
159
|
+
give_warning(ghenv.Component, msg.format(hdr_x, hdr_y))
|
|
160
|
+
|
|
161
|
+
# check resolution ratio of output image / input image
|
|
162
|
+
if hdr_view.h_size == 360 and hdr_view.v_size == 360:
|
|
163
|
+
if resolution is None:
|
|
164
|
+
resolution = hdr_resolution / 3
|
|
165
|
+
if resolution > hdr_resolution / 3:
|
|
166
|
+
msg = 'Recommended _resolution_ is one third or less of the _hdr resolution. \n' \
|
|
167
|
+
'Got {} for _resolution_ and {} for _hdr. Recommended _resolution_ \n' \
|
|
168
|
+
'is {} or lower.'
|
|
169
|
+
give_warning(ghenv.Component, msg.format(resolution, hdr_resolution,
|
|
170
|
+
int(hdr_resolution / 3)))
|
|
171
|
+
else:
|
|
172
|
+
if resolution is None:
|
|
173
|
+
resolution = hdr_resolution
|
|
174
|
+
if resolution > hdr_resolution:
|
|
175
|
+
msg = 'Output image resolution ({}) is larger than input image \n' \
|
|
176
|
+
'resolution ({}). It is recommended that _resolution_ is equal \n' \
|
|
177
|
+
'to or less than input image resolution.'
|
|
178
|
+
give_warning(ghenv.Component, msg.format(resolution, hdr_resolution))
|
|
179
|
+
return resolution
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
if all_required_inputs(ghenv.Component):
|
|
183
|
+
# check if _view is Honeybee Radiance View
|
|
184
|
+
assert isinstance(_view, View), \
|
|
185
|
+
'Expected Honeybee Radiance View in _view. Got {}.'.format(type(_view))
|
|
186
|
+
|
|
187
|
+
# check if header contains a view
|
|
188
|
+
hdr_view = check_view_hdr(_hdr)
|
|
189
|
+
|
|
190
|
+
# check view points
|
|
191
|
+
check_view_points(_view, hdr_view)
|
|
192
|
+
|
|
193
|
+
# check resolution
|
|
194
|
+
resolution = check_resolution(_hdr, _resolution_, _view, hdr_view)
|
|
195
|
+
|
|
196
|
+
# set up the paths for the various files used in translation
|
|
197
|
+
img_dir = os.path.dirname(_hdr)
|
|
198
|
+
input_image = os.path.basename(_hdr)
|
|
199
|
+
commands = []
|
|
200
|
+
|
|
201
|
+
# add the command to include exposure in the pixels
|
|
202
|
+
expos_image = input_image.lower().replace('.hdr', '_e.hdr')
|
|
203
|
+
ra_xyze = Ra_xyze(input=input_image, output=expos_image)
|
|
204
|
+
ra_xyze.options.r = True
|
|
205
|
+
ra_xyze.options.o = True
|
|
206
|
+
commands.append(ra_xyze)
|
|
207
|
+
|
|
208
|
+
# add the command to extract a view (HDR)
|
|
209
|
+
view_identifier = _view.identifier
|
|
210
|
+
view = os.path.basename(_view.to_file(img_dir))
|
|
211
|
+
pinterp_image = input_image.lower().replace('.hdr', '_{}.hdr'.format(view_identifier))
|
|
212
|
+
pinterp = Pinterp(output=pinterp_image, view=view, image=expos_image,
|
|
213
|
+
zspec=1)
|
|
214
|
+
pinterp.options.x = resolution
|
|
215
|
+
pinterp.options.y = resolution
|
|
216
|
+
commands.append(pinterp)
|
|
217
|
+
hdr = os.path.join(img_dir, pinterp_image)
|
|
218
|
+
|
|
219
|
+
# run the commands in series
|
|
220
|
+
env = None
|
|
221
|
+
if rad_folders.env != {}:
|
|
222
|
+
env = rad_folders.env
|
|
223
|
+
env = dict(os.environ, **env) if env else None
|
|
224
|
+
for r_cmd in commands:
|
|
225
|
+
r_cmd.run(env, cwd=img_dir)
|