honeybee-radiance 1.66.190__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.
Potentially problematic release.
This version of honeybee-radiance might be problematic. Click here for more details.
- honeybee_radiance/__init__.py +11 -0
- honeybee_radiance/__main__.py +4 -0
- honeybee_radiance/_extend_honeybee.py +93 -0
- honeybee_radiance/cli/__init__.py +88 -0
- honeybee_radiance/cli/dc.py +400 -0
- honeybee_radiance/cli/edit.py +529 -0
- honeybee_radiance/cli/glare.py +118 -0
- honeybee_radiance/cli/grid.py +859 -0
- honeybee_radiance/cli/lib.py +458 -0
- honeybee_radiance/cli/modifier.py +133 -0
- honeybee_radiance/cli/mtx.py +226 -0
- honeybee_radiance/cli/multiphase.py +1034 -0
- honeybee_radiance/cli/octree.py +640 -0
- honeybee_radiance/cli/postprocess.py +1186 -0
- honeybee_radiance/cli/raytrace.py +219 -0
- honeybee_radiance/cli/rpict.py +125 -0
- honeybee_radiance/cli/schedule.py +56 -0
- honeybee_radiance/cli/setconfig.py +63 -0
- honeybee_radiance/cli/sky.py +545 -0
- honeybee_radiance/cli/study.py +66 -0
- honeybee_radiance/cli/sunpath.py +331 -0
- honeybee_radiance/cli/threephase.py +255 -0
- honeybee_radiance/cli/translate.py +400 -0
- honeybee_radiance/cli/util.py +121 -0
- honeybee_radiance/cli/view.py +261 -0
- honeybee_radiance/cli/viewfactor.py +347 -0
- honeybee_radiance/config.json +6 -0
- honeybee_radiance/config.py +427 -0
- honeybee_radiance/dictutil.py +50 -0
- honeybee_radiance/dynamic/__init__.py +5 -0
- honeybee_radiance/dynamic/group.py +479 -0
- honeybee_radiance/dynamic/multiphase.py +557 -0
- honeybee_radiance/dynamic/state.py +718 -0
- honeybee_radiance/dynamic/stategeo.py +352 -0
- honeybee_radiance/geometry/__init__.py +13 -0
- honeybee_radiance/geometry/bubble.py +42 -0
- honeybee_radiance/geometry/cone.py +215 -0
- honeybee_radiance/geometry/cup.py +54 -0
- honeybee_radiance/geometry/cylinder.py +197 -0
- honeybee_radiance/geometry/geometrybase.py +37 -0
- honeybee_radiance/geometry/instance.py +40 -0
- honeybee_radiance/geometry/mesh.py +38 -0
- honeybee_radiance/geometry/polygon.py +174 -0
- honeybee_radiance/geometry/ring.py +214 -0
- honeybee_radiance/geometry/source.py +182 -0
- honeybee_radiance/geometry/sphere.py +178 -0
- honeybee_radiance/geometry/tube.py +46 -0
- honeybee_radiance/lib/__init__.py +1 -0
- honeybee_radiance/lib/_loadmodifiers.py +72 -0
- honeybee_radiance/lib/_loadmodifiersets.py +69 -0
- honeybee_radiance/lib/modifiers.py +58 -0
- honeybee_radiance/lib/modifiersets.py +63 -0
- honeybee_radiance/lightpath.py +204 -0
- honeybee_radiance/lightsource/__init__.py +1 -0
- honeybee_radiance/lightsource/_gendaylit.py +479 -0
- honeybee_radiance/lightsource/dictutil.py +49 -0
- honeybee_radiance/lightsource/ground.py +160 -0
- honeybee_radiance/lightsource/sky/__init__.py +7 -0
- honeybee_radiance/lightsource/sky/_skybase.py +177 -0
- honeybee_radiance/lightsource/sky/certainirradiance.py +232 -0
- honeybee_radiance/lightsource/sky/cie.py +378 -0
- honeybee_radiance/lightsource/sky/climatebased.py +501 -0
- honeybee_radiance/lightsource/sky/hemisphere.py +160 -0
- honeybee_radiance/lightsource/sky/skydome.py +113 -0
- honeybee_radiance/lightsource/sky/skymatrix.py +163 -0
- honeybee_radiance/lightsource/sky/strutil.py +34 -0
- honeybee_radiance/lightsource/sky/sunmatrix.py +212 -0
- honeybee_radiance/lightsource/sunpath.py +247 -0
- honeybee_radiance/modifier/__init__.py +3 -0
- honeybee_radiance/modifier/material/__init__.py +30 -0
- honeybee_radiance/modifier/material/absdf.py +477 -0
- honeybee_radiance/modifier/material/antimatter.py +54 -0
- honeybee_radiance/modifier/material/ashik2.py +51 -0
- honeybee_radiance/modifier/material/brtdfunc.py +81 -0
- honeybee_radiance/modifier/material/bsdf.py +292 -0
- honeybee_radiance/modifier/material/dielectric.py +53 -0
- honeybee_radiance/modifier/material/glass.py +431 -0
- honeybee_radiance/modifier/material/glow.py +246 -0
- honeybee_radiance/modifier/material/illum.py +51 -0
- honeybee_radiance/modifier/material/interface.py +49 -0
- honeybee_radiance/modifier/material/light.py +206 -0
- honeybee_radiance/modifier/material/materialbase.py +36 -0
- honeybee_radiance/modifier/material/metal.py +167 -0
- honeybee_radiance/modifier/material/metal2.py +41 -0
- honeybee_radiance/modifier/material/metdata.py +41 -0
- honeybee_radiance/modifier/material/metfunc.py +41 -0
- honeybee_radiance/modifier/material/mirror.py +340 -0
- honeybee_radiance/modifier/material/mist.py +86 -0
- honeybee_radiance/modifier/material/plasdata.py +58 -0
- honeybee_radiance/modifier/material/plasfunc.py +59 -0
- honeybee_radiance/modifier/material/plastic.py +354 -0
- honeybee_radiance/modifier/material/plastic2.py +58 -0
- honeybee_radiance/modifier/material/prism1.py +57 -0
- honeybee_radiance/modifier/material/prism2.py +48 -0
- honeybee_radiance/modifier/material/spotlight.py +50 -0
- honeybee_radiance/modifier/material/trans.py +518 -0
- honeybee_radiance/modifier/material/trans2.py +49 -0
- honeybee_radiance/modifier/material/transdata.py +50 -0
- honeybee_radiance/modifier/material/transfunc.py +53 -0
- honeybee_radiance/modifier/mixture/__init__.py +6 -0
- honeybee_radiance/modifier/mixture/mixdata.py +49 -0
- honeybee_radiance/modifier/mixture/mixfunc.py +54 -0
- honeybee_radiance/modifier/mixture/mixpict.py +52 -0
- honeybee_radiance/modifier/mixture/mixtext.py +66 -0
- honeybee_radiance/modifier/mixture/mixturebase.py +28 -0
- honeybee_radiance/modifier/modifierbase.py +40 -0
- honeybee_radiance/modifier/pattern/__init__.py +9 -0
- honeybee_radiance/modifier/pattern/brightdata.py +49 -0
- honeybee_radiance/modifier/pattern/brightfunc.py +47 -0
- honeybee_radiance/modifier/pattern/brighttext.py +81 -0
- honeybee_radiance/modifier/pattern/colordata.py +56 -0
- honeybee_radiance/modifier/pattern/colorfunc.py +47 -0
- honeybee_radiance/modifier/pattern/colorpict.py +54 -0
- honeybee_radiance/modifier/pattern/colortext.py +73 -0
- honeybee_radiance/modifier/pattern/patternbase.py +34 -0
- honeybee_radiance/modifier/texture/__init__.py +4 -0
- honeybee_radiance/modifier/texture/texdata.py +29 -0
- honeybee_radiance/modifier/texture/texfunc.py +26 -0
- honeybee_radiance/modifier/texture/texturebase.py +27 -0
- honeybee_radiance/modifierset.py +1091 -0
- honeybee_radiance/mutil.py +60 -0
- honeybee_radiance/postprocess/__init__.py +1 -0
- honeybee_radiance/postprocess/annual.py +108 -0
- honeybee_radiance/postprocess/annualdaylight.py +425 -0
- honeybee_radiance/postprocess/annualglare.py +201 -0
- honeybee_radiance/postprocess/annualirradiance.py +187 -0
- honeybee_radiance/postprocess/electriclight.py +119 -0
- honeybee_radiance/postprocess/en17037.py +261 -0
- honeybee_radiance/postprocess/leed.py +304 -0
- honeybee_radiance/postprocess/solartracking.py +90 -0
- honeybee_radiance/primitive.py +554 -0
- honeybee_radiance/properties/__init__.py +1 -0
- honeybee_radiance/properties/_base.py +390 -0
- honeybee_radiance/properties/aperture.py +197 -0
- honeybee_radiance/properties/door.py +198 -0
- honeybee_radiance/properties/face.py +123 -0
- honeybee_radiance/properties/model.py +1291 -0
- honeybee_radiance/properties/room.py +490 -0
- honeybee_radiance/properties/shade.py +186 -0
- honeybee_radiance/properties/shademesh.py +116 -0
- honeybee_radiance/putil.py +44 -0
- honeybee_radiance/reader.py +214 -0
- honeybee_radiance/sensor.py +166 -0
- honeybee_radiance/sensorgrid.py +1008 -0
- honeybee_radiance/view.py +1101 -0
- honeybee_radiance/writer.py +951 -0
- honeybee_radiance-1.66.190.dist-info/METADATA +89 -0
- honeybee_radiance-1.66.190.dist-info/RECORD +152 -0
- honeybee_radiance-1.66.190.dist-info/WHEEL +5 -0
- honeybee_radiance-1.66.190.dist-info/entry_points.txt +2 -0
- honeybee_radiance-1.66.190.dist-info/licenses/LICENSE +661 -0
- honeybee_radiance-1.66.190.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
"""Dynamic geometry that can be assigned to individual states."""
|
|
3
|
+
from ..modifier import Modifier
|
|
4
|
+
from ..geometry import Polygon
|
|
5
|
+
from ..mutil import dict_to_modifier # imports all modifiers classes
|
|
6
|
+
from ..lib.modifiers import black, generic_exterior_shade
|
|
7
|
+
|
|
8
|
+
from honeybee.typing import valid_rad_string
|
|
9
|
+
from ladybug_geometry.geometry3d.pointvector import Point3D
|
|
10
|
+
from ladybug_geometry.geometry3d.face import Face3D
|
|
11
|
+
|
|
12
|
+
import math
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class StateGeometry(object):
|
|
16
|
+
"""A single planar geometry that can be assigned to Radiance states.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
identifier: Text string for a unique geometry ID. Must not contain any
|
|
20
|
+
spaces or special characters.
|
|
21
|
+
geometry: A ladybug-geometry Face3D.
|
|
22
|
+
modifier: A Honeybee Radiance Modifier object for the geometry. If None,
|
|
23
|
+
it will be the Generic Exterior Shade modifier in the lib. (Default: None).
|
|
24
|
+
|
|
25
|
+
Properties:
|
|
26
|
+
* identifier
|
|
27
|
+
* display_name
|
|
28
|
+
* geometry
|
|
29
|
+
* modifier
|
|
30
|
+
* modifier_direct
|
|
31
|
+
* parent
|
|
32
|
+
* has_parent
|
|
33
|
+
* vertices
|
|
34
|
+
* normal
|
|
35
|
+
* center
|
|
36
|
+
* area
|
|
37
|
+
"""
|
|
38
|
+
__slots__ = ('_identifier', '_display_name', '_geometry', '_modifier',
|
|
39
|
+
'_modifier_direct', '_parent')
|
|
40
|
+
|
|
41
|
+
def __init__(self, identifier, geometry, modifier=None):
|
|
42
|
+
"""Initialize StateGeometry."""
|
|
43
|
+
# process the identifier
|
|
44
|
+
self._identifier = valid_rad_string(identifier, 'state geometry identifier')
|
|
45
|
+
self._display_name = self._identifier
|
|
46
|
+
# process the geometry
|
|
47
|
+
assert isinstance(geometry, Face3D), \
|
|
48
|
+
'Expected ladybug_geometry Face3D. Got {}'.format(type(geometry))
|
|
49
|
+
self._geometry = geometry
|
|
50
|
+
# process the modifier
|
|
51
|
+
self.modifier = modifier
|
|
52
|
+
self._modifier_direct = None
|
|
53
|
+
self._parent = None # _parent will be set when the Geo is added to a state
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_dict(cls, data):
|
|
57
|
+
"""Initialize a StateGeometry from a dictionary.
|
|
58
|
+
|
|
59
|
+
Note that the dictionary must be a non-abridged version for this
|
|
60
|
+
classmethod to work.
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
data: A dictionary representation of an StateGeometry with the
|
|
64
|
+
format below.
|
|
65
|
+
|
|
66
|
+
.. code-block:: python
|
|
67
|
+
|
|
68
|
+
{
|
|
69
|
+
'type': 'StateGeometry',
|
|
70
|
+
'identifier': str, # Text for the unique object identifier
|
|
71
|
+
'display_name': str, # Optional text for the display name
|
|
72
|
+
'geometry': {}, # A ladybug_geometry Face3D dictionary
|
|
73
|
+
'modifier': {}, # A Honeybee Radiance Modifier dictionary
|
|
74
|
+
'modifier_direct': {} # A Honeybee Radiance Modifier dictionary
|
|
75
|
+
}
|
|
76
|
+
"""
|
|
77
|
+
# check the type of dictionary
|
|
78
|
+
assert data['type'] == 'StateGeometry', 'Expected StateGeometry dictionary. ' \
|
|
79
|
+
'Got {}.'.format(data['type'])
|
|
80
|
+
geo = cls(data['identifier'], Face3D.from_dict(data['geometry']))
|
|
81
|
+
|
|
82
|
+
if 'modifier' in data and data['modifier'] is not None:
|
|
83
|
+
geo.modifier = dict_to_modifier(data['modifier'])
|
|
84
|
+
if 'modifier_direct' in data and data['modifier_direct'] is not None:
|
|
85
|
+
geo.modifier_direct = dict_to_modifier(data['modifier_direct'])
|
|
86
|
+
if 'display_name' in data and data['display_name'] is not None:
|
|
87
|
+
geo.display_name = data['display_name']
|
|
88
|
+
return geo
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict_abridged(cls, data, modifiers):
|
|
92
|
+
"""Create StateGeometry from an abridged dictionary.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
data: A dictionary representation of StateGeometryAbridged with
|
|
96
|
+
the format below.
|
|
97
|
+
modifiers: A dictionary of modifiers with modifier identifiers as keys,
|
|
98
|
+
which will be used to re-assign modifiers.
|
|
99
|
+
|
|
100
|
+
.. code-block:: python
|
|
101
|
+
|
|
102
|
+
{
|
|
103
|
+
'type': 'StateGeometryAbridged',
|
|
104
|
+
'identifier': str, # Text for the unique object identifier
|
|
105
|
+
'display_name': str, # Optional text for the display name
|
|
106
|
+
'geometry': {}, # A ladybug_geometry Face3D dictionary
|
|
107
|
+
'modifier': str # A Honeybee Radiance Modifier identifier
|
|
108
|
+
'modifier_direct': str # A Honeybee Radiance Modifier identifier
|
|
109
|
+
}
|
|
110
|
+
"""
|
|
111
|
+
# check the type of dictionary
|
|
112
|
+
assert data['type'] == 'StateGeometryAbridged', \
|
|
113
|
+
'Expected StateGeometryAbridged dictionary. Got {}.'.format(data['type'])
|
|
114
|
+
geo = cls(data['identifier'], Face3D.from_dict(data['geometry']))
|
|
115
|
+
|
|
116
|
+
if 'modifier' in data and data['modifier'] is not None:
|
|
117
|
+
geo.modifier = modifiers[data['modifier']]
|
|
118
|
+
if 'modifier_direct' in data and data['modifier_direct'] is not None:
|
|
119
|
+
geo.modifier_direct = modifiers[data['modifier_direct']]
|
|
120
|
+
if 'display_name' in data and data['display_name'] is not None:
|
|
121
|
+
geo.display_name = data['display_name']
|
|
122
|
+
return geo
|
|
123
|
+
|
|
124
|
+
@classmethod
|
|
125
|
+
def from_vertices(cls, identifier, vertices, modifier=None):
|
|
126
|
+
"""Create StateGeometry from vertices with each vertex as an iterable of 3 floats.
|
|
127
|
+
|
|
128
|
+
Note that this method is not recommended for a geometry with one or more holes
|
|
129
|
+
since the distinction between hole vertices and boundary vertices cannot
|
|
130
|
+
be derived from a single list of vertices.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
identifier: Text string for a unique geometry ID. Must not contain any
|
|
134
|
+
spaces or special characters.
|
|
135
|
+
vertices: A flattened list of 3 or more vertices as (x, y, z).
|
|
136
|
+
modifier: A Honeybee Radiance Modifier object for the geometry. If None, it
|
|
137
|
+
will be the Generic Exterior Shade modifier in the lib. (Default: None).
|
|
138
|
+
"""
|
|
139
|
+
geometry = Face3D(tuple(Point3D(*v) for v in vertices))
|
|
140
|
+
return cls(identifier, geometry, modifier)
|
|
141
|
+
|
|
142
|
+
@property
|
|
143
|
+
def identifier(self):
|
|
144
|
+
"""Get a text string for the unique object identifer.
|
|
145
|
+
|
|
146
|
+
This identifier remains constant as the object is mutated, copied, and
|
|
147
|
+
serialized to different formats (eg. dict, idf, rad). As such, this
|
|
148
|
+
property is used to reference the object across a Model.
|
|
149
|
+
"""
|
|
150
|
+
return self._identifier
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def display_name(self):
|
|
154
|
+
"""Get or set a string for the object name without any character restrictions.
|
|
155
|
+
|
|
156
|
+
If not set, this will be equal to the identifier.
|
|
157
|
+
"""
|
|
158
|
+
return self._display_name
|
|
159
|
+
|
|
160
|
+
@display_name.setter
|
|
161
|
+
def display_name(self, value):
|
|
162
|
+
try:
|
|
163
|
+
self._display_name = str(value)
|
|
164
|
+
except UnicodeEncodeError: # Python 2 machine lacking the character set
|
|
165
|
+
self._display_name = value # keep it as unicode
|
|
166
|
+
|
|
167
|
+
@property
|
|
168
|
+
def geometry(self):
|
|
169
|
+
"""Get a ladybug_geometry Face3D object representing the Shade."""
|
|
170
|
+
return self._geometry
|
|
171
|
+
|
|
172
|
+
@property
|
|
173
|
+
def modifier(self):
|
|
174
|
+
"""Get or set the object modifier."""
|
|
175
|
+
if self._modifier: # set by user
|
|
176
|
+
return self._modifier
|
|
177
|
+
return generic_exterior_shade
|
|
178
|
+
|
|
179
|
+
@modifier.setter
|
|
180
|
+
def modifier(self, value):
|
|
181
|
+
if value is not None:
|
|
182
|
+
assert isinstance(value, Modifier), \
|
|
183
|
+
'Expected Radiance Modifier for shade. Got {}'.format(type(value))
|
|
184
|
+
value.lock() # lock editing in case modifier has multiple references
|
|
185
|
+
self._modifier = value
|
|
186
|
+
|
|
187
|
+
@property
|
|
188
|
+
def modifier_direct(self):
|
|
189
|
+
"""Get or set a modifier to be used in direct solar studies.
|
|
190
|
+
|
|
191
|
+
If None, this will be a completely black material if the object's modifier is
|
|
192
|
+
opaque and will be equal to the modifier if the object's modifier is non-opaque.
|
|
193
|
+
"""
|
|
194
|
+
if self._modifier_direct: # set by user
|
|
195
|
+
return self._modifier_direct
|
|
196
|
+
mod = self.modifier # assign a default based on whether the modifier is opaque
|
|
197
|
+
if mod.is_void or mod.is_opaque:
|
|
198
|
+
return black
|
|
199
|
+
else:
|
|
200
|
+
return mod
|
|
201
|
+
|
|
202
|
+
@modifier_direct.setter
|
|
203
|
+
def modifier_direct(self, value):
|
|
204
|
+
if value is not None:
|
|
205
|
+
assert isinstance(value, Modifier), \
|
|
206
|
+
'Expected Radiance Modifier. Got {}'.format(type(value))
|
|
207
|
+
value.lock() # lock editing in case modifier has multiple references
|
|
208
|
+
self._modifier_direct = value
|
|
209
|
+
|
|
210
|
+
@property
|
|
211
|
+
def is_opaque(self):
|
|
212
|
+
"""Boolean noting whether this geomtry has an opaque modifier."""
|
|
213
|
+
return True if self.modifier.is_void else self.modifier.is_opaque
|
|
214
|
+
|
|
215
|
+
@property
|
|
216
|
+
def parent(self):
|
|
217
|
+
"""Get the parent State if assigned. None if not assigned."""
|
|
218
|
+
return self._parent
|
|
219
|
+
|
|
220
|
+
@property
|
|
221
|
+
def has_parent(self):
|
|
222
|
+
"""Get a boolean noting whether this StateGeometry has a parent State."""
|
|
223
|
+
return self._parent is not None
|
|
224
|
+
|
|
225
|
+
@property
|
|
226
|
+
def vertices(self):
|
|
227
|
+
"""Get a list of vertices for the geometry (in counter-clockwise order)."""
|
|
228
|
+
return self._geometry.vertices
|
|
229
|
+
|
|
230
|
+
@property
|
|
231
|
+
def normal(self):
|
|
232
|
+
"""Get a ladybug_geometry Vector3D for the direction the geometry is pointing.
|
|
233
|
+
"""
|
|
234
|
+
return self._geometry.normal
|
|
235
|
+
|
|
236
|
+
@property
|
|
237
|
+
def center(self):
|
|
238
|
+
"""Get a ladybug_geometry Point3D for the center of the geometry.
|
|
239
|
+
|
|
240
|
+
Note that this is the center of the bounding rectangle around this geometry
|
|
241
|
+
and not the area centroid.
|
|
242
|
+
"""
|
|
243
|
+
return self._geometry.center
|
|
244
|
+
|
|
245
|
+
@property
|
|
246
|
+
def area(self):
|
|
247
|
+
"""Get the area of the geometry."""
|
|
248
|
+
return self._geometry.area
|
|
249
|
+
|
|
250
|
+
def move(self, moving_vec):
|
|
251
|
+
"""Move this StateGeometry along a vector.
|
|
252
|
+
|
|
253
|
+
Args:
|
|
254
|
+
moving_vec: A ladybug_geometry Vector3D with the direction and distance
|
|
255
|
+
to move the face.
|
|
256
|
+
"""
|
|
257
|
+
self._geometry = self.geometry.move(moving_vec)
|
|
258
|
+
|
|
259
|
+
def rotate(self, axis, angle, origin):
|
|
260
|
+
"""Rotate this StateGeometry by a certain angle around an axis and origin.
|
|
261
|
+
|
|
262
|
+
Args:
|
|
263
|
+
axis: A ladybug_geometry Vector3D axis representing the axis of rotation.
|
|
264
|
+
angle: An angle for rotation in degrees.
|
|
265
|
+
origin: A ladybug_geometry Point3D for the origin around which the
|
|
266
|
+
object will be rotated.
|
|
267
|
+
"""
|
|
268
|
+
self._geometry = self.geometry.rotate(axis, math.radians(angle), origin)
|
|
269
|
+
|
|
270
|
+
def rotate_xy(self, angle, origin):
|
|
271
|
+
"""Rotate this StateGeometry counterclockwise in the XY plane by a certain angle.
|
|
272
|
+
|
|
273
|
+
Args:
|
|
274
|
+
angle: An angle in degrees.
|
|
275
|
+
origin: A ladybug_geometry Point3D for the origin around which the
|
|
276
|
+
object will be rotated.
|
|
277
|
+
"""
|
|
278
|
+
self._geometry = self.geometry.rotate_xy(math.radians(angle), origin)
|
|
279
|
+
|
|
280
|
+
def reflect(self, plane):
|
|
281
|
+
"""Reflect this StateGeometry across a plane.
|
|
282
|
+
|
|
283
|
+
Args:
|
|
284
|
+
plane: A ladybug_geometry Plane across which the object will
|
|
285
|
+
be reflected.
|
|
286
|
+
"""
|
|
287
|
+
self._geometry = self.geometry.reflect(plane.n, plane.o)
|
|
288
|
+
|
|
289
|
+
def scale(self, factor, origin=None):
|
|
290
|
+
"""Scale this StateGeometry by a factor from an origin point.
|
|
291
|
+
|
|
292
|
+
Args:
|
|
293
|
+
factor: A number representing how much the object should be scaled.
|
|
294
|
+
origin: A ladybug_geometry Point3D representing the origin from which
|
|
295
|
+
to scale. If None, it will be scaled from the World origin (0, 0, 0).
|
|
296
|
+
"""
|
|
297
|
+
self._geometry = self.geometry.scale(factor, origin)
|
|
298
|
+
|
|
299
|
+
def to_dict(self, abridged=False):
|
|
300
|
+
"""Return StateGeometry as a dictionary.
|
|
301
|
+
|
|
302
|
+
Args:
|
|
303
|
+
abridged: Boolean to note whether the full dictionary describing the
|
|
304
|
+
object should be returned (False) or just an abridged version (True).
|
|
305
|
+
Default: False.
|
|
306
|
+
"""
|
|
307
|
+
# assign required properties
|
|
308
|
+
base = {'type': 'StateGeometryAbridged'} if abridged else \
|
|
309
|
+
{'type': 'StateGeometry'}
|
|
310
|
+
base['identifier'] = self.identifier
|
|
311
|
+
base['display_name'] = self.display_name
|
|
312
|
+
base['geometry'] = self.geometry.to_dict()
|
|
313
|
+
|
|
314
|
+
# assign optional properties
|
|
315
|
+
if self._modifier:
|
|
316
|
+
base['modifier'] = self._modifier.identifier if abridged else \
|
|
317
|
+
self._modifier.to_dict()
|
|
318
|
+
if self._modifier_direct is not None:
|
|
319
|
+
base['modifier_direct'] = self._modifier_direct.identifier if abridged \
|
|
320
|
+
else self._modifier.to_dict()
|
|
321
|
+
return base
|
|
322
|
+
|
|
323
|
+
def to_radiance(self, direct=False, minimal=False):
|
|
324
|
+
"""Generate a RAD string representation of this StateGeometry.
|
|
325
|
+
|
|
326
|
+
Note that the resulting string lacks modifiers.
|
|
327
|
+
|
|
328
|
+
Args:
|
|
329
|
+
direct: Boolean to note whether to write the "direct" version of the
|
|
330
|
+
state, which will have the modifier_direct applied. (Default: False)
|
|
331
|
+
minimal: Boolean to note whether the radiance string should be written
|
|
332
|
+
in a minimal format (with spaces instead of line breaks). Default: False.
|
|
333
|
+
"""
|
|
334
|
+
modifier = self.modifier_direct if direct else self.modifier
|
|
335
|
+
base_poly = Polygon(self.identifier, self.vertices, modifier)
|
|
336
|
+
return base_poly.to_radiance(minimal, False, False)
|
|
337
|
+
|
|
338
|
+
def duplicate(self):
|
|
339
|
+
"""Get a copy of this object."""
|
|
340
|
+
return self.__copy__()
|
|
341
|
+
|
|
342
|
+
def __copy__(self):
|
|
343
|
+
new_geo = StateGeometry(self.identifier, self.geometry, self._modifier)
|
|
344
|
+
new_geo._modifier_direct = self._modifier_direct
|
|
345
|
+
new_geo._display_name = self.display_name
|
|
346
|
+
return new_geo
|
|
347
|
+
|
|
348
|
+
def ToString(self):
|
|
349
|
+
return self.__repr__()
|
|
350
|
+
|
|
351
|
+
def __repr__(self):
|
|
352
|
+
return 'StateGeometry: %s' % self.display_name
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Radiance Geometries."""
|
|
2
|
+
|
|
3
|
+
from .bubble import Bubble
|
|
4
|
+
from .cone import Cone
|
|
5
|
+
from .cup import Cup
|
|
6
|
+
from .cylinder import Cylinder
|
|
7
|
+
from .instance import Instance
|
|
8
|
+
from .mesh import Mesh
|
|
9
|
+
from .polygon import Polygon
|
|
10
|
+
from .ring import Ring
|
|
11
|
+
from .source import Source
|
|
12
|
+
from .sphere import Sphere
|
|
13
|
+
from .tube import Tube
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Radiance Bubble.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Bubble
|
|
4
|
+
"""
|
|
5
|
+
from .sphere import Sphere
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Bubble(Sphere):
|
|
9
|
+
"""Radiance Bubble.
|
|
10
|
+
|
|
11
|
+
A bubble is simply a sphere whose surface normal points inward.
|
|
12
|
+
|
|
13
|
+
.. code-block:: shell
|
|
14
|
+
|
|
15
|
+
mod bubble id
|
|
16
|
+
0
|
|
17
|
+
0
|
|
18
|
+
4 xcent ycent zcent radius
|
|
19
|
+
|
|
20
|
+
Args:
|
|
21
|
+
identifier: Text string for a unique Geometry ID. Must not contain spaces
|
|
22
|
+
or special characters. This will be used to identify the object across
|
|
23
|
+
a model and in the exported Radiance files.
|
|
24
|
+
center_pt: Sphere center point as (x, y, z) (Default: (0, 0 ,0)).
|
|
25
|
+
radius: Bubble radius as a number (Default: 10).
|
|
26
|
+
modifier: Geometry modifier (Default: None).
|
|
27
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
28
|
+
argument is only useful for defining advanced primitives where the
|
|
29
|
+
primitive is defined based on other primitives. (Default: [])
|
|
30
|
+
|
|
31
|
+
Properties:
|
|
32
|
+
* identifier
|
|
33
|
+
* display_name
|
|
34
|
+
* center_pt
|
|
35
|
+
* radius
|
|
36
|
+
* modifier
|
|
37
|
+
* dependencies
|
|
38
|
+
* values
|
|
39
|
+
"""
|
|
40
|
+
__slots__ = ()
|
|
41
|
+
|
|
42
|
+
pass
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"""Radiance Cone.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Cone
|
|
4
|
+
"""
|
|
5
|
+
from .geometrybase import Geometry
|
|
6
|
+
import honeybee.typing as typing
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Cone(Geometry):
|
|
10
|
+
"""Radiance Cone.
|
|
11
|
+
|
|
12
|
+
A cone is a megaphone-shaped object. It is truncated by two planes perpendicular to
|
|
13
|
+
its axis, and one of its ends may come to a point. It is given as two axis endpoints,
|
|
14
|
+
and the starting and ending radii:
|
|
15
|
+
|
|
16
|
+
.. code-block:: shell
|
|
17
|
+
|
|
18
|
+
mod cone id
|
|
19
|
+
0
|
|
20
|
+
0
|
|
21
|
+
8
|
|
22
|
+
x0 y0 z0
|
|
23
|
+
x1 y1 z1
|
|
24
|
+
r0 r1
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
identifier: Text string for a unique Geometry ID. Must not contain spaces
|
|
28
|
+
or special characters. This will be used to identify the object across
|
|
29
|
+
a model and in the exported Radiance files.
|
|
30
|
+
center_pt_start: Cone start center point as (x, y, z) (Default: (0, 0 ,0)).
|
|
31
|
+
radius_start: Cone start radius as a number (Default: 10).
|
|
32
|
+
center_pt_end: Cone end center point as (x, y, z) (Default: (0, 0 ,10)).
|
|
33
|
+
radius_end: Cone end radius as a number (Default: 0).
|
|
34
|
+
modifier: Geometry modifier (Default: None).
|
|
35
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
36
|
+
argument is only useful for defining advanced primitives where the
|
|
37
|
+
primitive is defined based on other primitives. (Default: [])
|
|
38
|
+
|
|
39
|
+
Properties:
|
|
40
|
+
* identifier
|
|
41
|
+
* display_name
|
|
42
|
+
* center_pt_start
|
|
43
|
+
* radius_start
|
|
44
|
+
* center_pt_end
|
|
45
|
+
* radius_end
|
|
46
|
+
* values
|
|
47
|
+
* modifier
|
|
48
|
+
* dependencies
|
|
49
|
+
|
|
50
|
+
"""
|
|
51
|
+
__slots__ = ('_center_pt_start', '_radius_start', '_center_pt_end', '_radius_end')
|
|
52
|
+
|
|
53
|
+
def __init__(self, identifier, center_pt_start=None, radius_start=10,
|
|
54
|
+
center_pt_end=None, radius_end=0, modifier=None, dependencies=None):
|
|
55
|
+
"""Radiance Cone."""
|
|
56
|
+
Geometry.__init__(self, identifier, modifier=modifier, dependencies=dependencies)
|
|
57
|
+
self.center_pt_start = center_pt_start or (0, 0, 0)
|
|
58
|
+
self.radius_start = radius_start if radius_start is not None else 10
|
|
59
|
+
self.center_pt_end = center_pt_end or (0, 0, 10)
|
|
60
|
+
self.radius_end = radius_end if radius_end is not None else 0
|
|
61
|
+
self._update_values()
|
|
62
|
+
|
|
63
|
+
def _update_values(self):
|
|
64
|
+
"""update value dictionaries."""
|
|
65
|
+
self._values[2] = \
|
|
66
|
+
[self.center_pt_start[0], self.center_pt_start[1], self.center_pt_start[2],
|
|
67
|
+
self.center_pt_end[0], self.center_pt_end[1], self.center_pt_end[2],
|
|
68
|
+
self.radius_start, self.radius_end]
|
|
69
|
+
|
|
70
|
+
@property
|
|
71
|
+
def center_pt_start(self):
|
|
72
|
+
"""Cone start center point as (x, y, z). Default is (0, 0 ,0)."""
|
|
73
|
+
return self._center_pt_start
|
|
74
|
+
|
|
75
|
+
@center_pt_start.setter
|
|
76
|
+
def center_pt_start(self, value):
|
|
77
|
+
self._center_pt_start = tuple(float(v) for v in value)
|
|
78
|
+
assert len(self._center_pt_start) == 3, \
|
|
79
|
+
'Radiance Cone center point must have 3 values for (x, y, z).'
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def radius_start(self):
|
|
83
|
+
"""Cone start radius as a number. Default is 10."""
|
|
84
|
+
return self._radius_start
|
|
85
|
+
|
|
86
|
+
@radius_start.setter
|
|
87
|
+
def radius_start(self, value):
|
|
88
|
+
self._radius_start = typing.float_positive(value)
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def center_pt_end(self):
|
|
92
|
+
"""Cone end center point as (x, y, z). Default is (0, 0 ,10)."""
|
|
93
|
+
return self._center_pt_end
|
|
94
|
+
|
|
95
|
+
@center_pt_end.setter
|
|
96
|
+
def center_pt_end(self, value):
|
|
97
|
+
self._center_pt_end = tuple(float(v) for v in value)
|
|
98
|
+
assert len(self._center_pt_end) == 3, \
|
|
99
|
+
'Radiance Cone center point must have 3 values for (x, y, z).'
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def radius_end(self):
|
|
103
|
+
""" Cone end radius as a number. Default is 0."""
|
|
104
|
+
return self._radius_end
|
|
105
|
+
|
|
106
|
+
@radius_end.setter
|
|
107
|
+
def radius_end(self, value):
|
|
108
|
+
self._radius_end = typing.float_positive(value)
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def from_primitive_dict(cls, primitive_dict):
|
|
112
|
+
"""Initialize a Cone from a primitive dict.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
data: A dictionary in the format below.
|
|
116
|
+
|
|
117
|
+
.. code-block:: python
|
|
118
|
+
|
|
119
|
+
{
|
|
120
|
+
"modifier": {}, # primitive modifier (Default: None)
|
|
121
|
+
"type": "cone", # primitive type
|
|
122
|
+
"identifier": "", # primitive identifier
|
|
123
|
+
"display_name": "", # primitive display name
|
|
124
|
+
"values": [], # values
|
|
125
|
+
"dependencies": []
|
|
126
|
+
}
|
|
127
|
+
"""
|
|
128
|
+
assert 'type' in primitive_dict, 'Input dictionary is missing "type".'
|
|
129
|
+
if primitive_dict['type'] != cls.__name__.lower():
|
|
130
|
+
raise ValueError(
|
|
131
|
+
'Type must be %s not %s.' % (cls.__name__.lower(), primitive_dict['type'])
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
modifier, dependencies = cls.filter_dict_input(primitive_dict)
|
|
135
|
+
values = primitive_dict['values'][2]
|
|
136
|
+
|
|
137
|
+
cls_ = cls(
|
|
138
|
+
identifier=primitive_dict['identifier'],
|
|
139
|
+
center_pt_start=values[0:3],
|
|
140
|
+
radius_start=values[6],
|
|
141
|
+
center_pt_end=values[3:6],
|
|
142
|
+
radius_end=values[7],
|
|
143
|
+
modifier=modifier,
|
|
144
|
+
dependencies=dependencies
|
|
145
|
+
)
|
|
146
|
+
if 'display_name' in primitive_dict and primitive_dict['display_name'] is not None:
|
|
147
|
+
cls_.display_name = primitive_dict['display_name']
|
|
148
|
+
|
|
149
|
+
# this might look redundant but it is NOT. see glass for explanation.
|
|
150
|
+
cls_.values = primitive_dict['values']
|
|
151
|
+
return cls_
|
|
152
|
+
|
|
153
|
+
@classmethod
|
|
154
|
+
def from_dict(cls, data):
|
|
155
|
+
"""Initialize a Cone from a dictionary.
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
data: A dictionary in the format below.
|
|
159
|
+
|
|
160
|
+
.. code-block:: python
|
|
161
|
+
|
|
162
|
+
{
|
|
163
|
+
"type": "cone", # Geometry type
|
|
164
|
+
"modifier": {} ,
|
|
165
|
+
"identifier": "", # Geometry identifer
|
|
166
|
+
"display_name": "", # Geometry display name
|
|
167
|
+
"center_pt_start": (0, 0, 0),
|
|
168
|
+
"radius_start": float,
|
|
169
|
+
"center_pt_end": (0, 0, 10),
|
|
170
|
+
"radius_end": float,
|
|
171
|
+
"dependencies": []
|
|
172
|
+
}
|
|
173
|
+
"""
|
|
174
|
+
assert 'type' in data, 'Input dictionary is missing "type".'
|
|
175
|
+
if data['type'] != cls.__name__.lower():
|
|
176
|
+
raise ValueError(
|
|
177
|
+
'Type must be %s not %s.' % (cls.__name__.lower(),
|
|
178
|
+
data['type'])
|
|
179
|
+
)
|
|
180
|
+
modifier, dependencies = cls.filter_dict_input(data)
|
|
181
|
+
|
|
182
|
+
new_obj = cls(identifier=data["identifier"],
|
|
183
|
+
center_pt_start=(data["center_pt_start"]),
|
|
184
|
+
radius_start=data["radius_start"],
|
|
185
|
+
center_pt_end=( data["center_pt_end"]),
|
|
186
|
+
radius_end=data["radius_end"],
|
|
187
|
+
modifier=modifier,
|
|
188
|
+
dependencies=dependencies)
|
|
189
|
+
if 'display_name' in data and data['display_name'] is not None:
|
|
190
|
+
new_obj.display_name = data['display_name']
|
|
191
|
+
return new_obj
|
|
192
|
+
|
|
193
|
+
def to_dict(self):
|
|
194
|
+
"""Translate this object to a dictionary."""
|
|
195
|
+
base = {
|
|
196
|
+
"modifier": self.modifier.to_dict(),
|
|
197
|
+
"type": self.__class__.__name__.lower(),
|
|
198
|
+
"identifier": self.identifier,
|
|
199
|
+
"radius_start": self.radius_start,
|
|
200
|
+
"center_pt_start": self.center_pt_start,
|
|
201
|
+
"radius_end": self.radius_end,
|
|
202
|
+
"center_pt_end": self.center_pt_end,
|
|
203
|
+
'dependencies': [dp.to_dict() for dp in self.dependencies]
|
|
204
|
+
}
|
|
205
|
+
if self._display_name is not None:
|
|
206
|
+
base['display_name'] = self.display_name
|
|
207
|
+
return base
|
|
208
|
+
|
|
209
|
+
def __copy__(self):
|
|
210
|
+
mod, depend = self._dup_mod_and_depend()
|
|
211
|
+
new_obj = self.__class__(
|
|
212
|
+
self.identifier, self.center_pt_start, self.radius_start, self.center_pt_end,
|
|
213
|
+
self.radius_end, mod, depend)
|
|
214
|
+
new_obj._display_name = self._display_name
|
|
215
|
+
return new_obj
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Radiance Cup.
|
|
2
|
+
|
|
3
|
+
http://radsite.lbl.gov/radiance/refer/ray.html#Cup
|
|
4
|
+
"""
|
|
5
|
+
from .cone import Cone
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Cup(Cone):
|
|
9
|
+
"""Radiance Cup.
|
|
10
|
+
|
|
11
|
+
A cup is an inverted cone (i.e., has an inward surface normal).
|
|
12
|
+
|
|
13
|
+
A cone is a megaphone-shaped object. It is truncated by two planes perpendicular to
|
|
14
|
+
its axis, and one of its ends may come to a point. It is given as two axis endpoints,
|
|
15
|
+
and the starting and ending radii:
|
|
16
|
+
|
|
17
|
+
.. code-block:: shell
|
|
18
|
+
|
|
19
|
+
mod cup id
|
|
20
|
+
0
|
|
21
|
+
0
|
|
22
|
+
8
|
|
23
|
+
x0 y0 z0
|
|
24
|
+
x1 y1 z1
|
|
25
|
+
r0 r1
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
identifier: Text string for a unique Geometry ID. Must not contain spaces
|
|
29
|
+
or special characters. This will be used to identify the object across
|
|
30
|
+
a model and in the exported Radiance files.
|
|
31
|
+
center_pt_start: Cup start center point as (x, y, z) (Default: (0, 0 ,0)).
|
|
32
|
+
radius_start: Cup start radius as a number (Default: 10).
|
|
33
|
+
center_pt_end: Cup end center point as (x, y, z) (Default: (0, 0 ,10)).
|
|
34
|
+
radius_end: Cup end radius as a number (Default: 0).
|
|
35
|
+
modifier: Geometry modifier (Default: None).
|
|
36
|
+
dependencies: A list of primitives that this primitive depends on. This
|
|
37
|
+
argument is only useful for defining advanced primitives where the
|
|
38
|
+
primitive is defined based on other primitives. (Default: [])
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
Properties:
|
|
42
|
+
* identifier
|
|
43
|
+
* display_name
|
|
44
|
+
* center_pt_start
|
|
45
|
+
* radius_start
|
|
46
|
+
* center_pt_end
|
|
47
|
+
* radius_end
|
|
48
|
+
* values
|
|
49
|
+
* modifier
|
|
50
|
+
* dependencies
|
|
51
|
+
"""
|
|
52
|
+
__slots__ = ()
|
|
53
|
+
|
|
54
|
+
pass
|