Skip to content

Commit a170cbf

Browse files
committed
fix(cli): Update CLI to use the new plenum defaults
1 parent e9139b5 commit a170cbf

File tree

4 files changed

+43
-33
lines changed

4 files changed

+43
-33
lines changed

dragonfly_display/cli/__init__.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def display():
3535
'generated Honeybee Room objects or if full geometry objects should be '
3636
'written for each story in the building.', default=True, show_default=True)
3737
@click.option(
38-
'--no-plenum/--plenum', ' /-p', help='Flag to indicate whether '
39-
'ceiling/floor plenums should be auto-generated for the Rooms.',
40-
default=True, show_default=True)
38+
'--plenum/--no-plenum', '-p/-np', help='Flag to indicate whether '
39+
'ceiling/floor plenum depths assigned to Room2Ds should generate '
40+
'distinct 3D Rooms in the translation.', default=True, show_default=True)
4141
@click.option(
4242
'--no-ceil-adjacency/--ceil-adjacency', ' /-a', help='Flag to indicate '
4343
'whether adjacencies should be solved between interior stories when '
@@ -118,7 +118,7 @@ def display():
118118
'file contents. By default, it will be printed out to stdout.',
119119
type=click.File('w'), default='-', show_default=True)
120120
def model_to_vis_set_cli(
121-
model_file, multiplier, no_plenum, no_ceil_adjacency,
121+
model_file, multiplier, plenum, no_ceil_adjacency,
122122
color_by, wireframe, mesh, show_color_by,
123123
room_attr, face_attr, color_attr, grid_display_mode, show_grid,
124124
output_format, output_file):
@@ -134,7 +134,7 @@ def model_to_vis_set_cli(
134134
try:
135135
# process all of the CLI input so that it can be passed to the function
136136
full_geometry = not multiplier
137-
add_plenum = not no_plenum
137+
no_plenum = not plenum
138138
ceil_adjacency = not no_ceil_adjacency
139139
exclude_wireframe = not wireframe
140140
faces = not mesh
@@ -145,7 +145,7 @@ def model_to_vis_set_cli(
145145
hide_grid = not show_grid
146146

147147
# pass the input to the function in order to convert the model
148-
model_to_vis_set(model_file, full_geometry, add_plenum, ceil_adjacency, color_by,
148+
model_to_vis_set(model_file, full_geometry, no_plenum, ceil_adjacency, color_by,
149149
exclude_wireframe, faces, hide_color_by,
150150
room_attrs, face_attrs, text_labels, grid_display_mode,
151151
hide_grid, output_format, output_file)
@@ -157,11 +157,11 @@ def model_to_vis_set_cli(
157157

158158

159159
def model_to_vis_set(
160-
model_file, full_geometry=False, plenum=False, ceil_adjacency=False,
160+
model_file, full_geometry=False, no_plenum=False, ceil_adjacency=False,
161161
color_by='type', exclude_wireframe=False, faces=False, hide_color_by=False,
162162
room_attr=(), face_attr=(), text_attr=False, grid_display_mode='Default',
163163
hide_grid=False, output_format='vsf', output_file=None,
164-
multiplier=True, no_plenum=True, no_ceil_adjacency=True, wireframe=True, mesh=True,
164+
multiplier=True, plenum=True, no_ceil_adjacency=True, wireframe=True, mesh=True,
165165
show_color_by=True, color_attr=True, show_grid=True
166166
):
167167
"""Translate a Dragonfly Model file (.dfjson) to a VisualizationSet file (.vsf).
@@ -174,8 +174,9 @@ def model_to_vis_set(
174174
full_geometry: Boolean to note if the multipliers on each Story should
175175
be passed along to the generated Honeybee Room objects or if full
176176
geometry objects should be written for each story in the building.
177-
plenum: Boolean to indicate whether ceiling/floor plenums should
178-
be auto-generated for the Rooms. (Default: False).
177+
no_plenum: Boolean to indicate whether ceiling/floor plenum depths
178+
assigned to Room2Ds should generate distinct 3D Rooms in the
179+
translation. (Default: False).
179180
ceil_adjacency: Boolean to indicate whether adjacencies should be solved
180181
between interior stories when Room2D floor and ceiling geometries
181182
are coplanar. This ensures that Surface boundary conditions are used
@@ -259,7 +260,7 @@ def model_to_vis_set(
259260
# create the VisualizationSet
260261
multiplier = not full_geometry
261262
vis_set = model_obj.to_vis_set(
262-
multiplier, plenum, ceil_adjacency, color_by=color_by,
263+
multiplier, no_plenum, ceil_adjacency, color_by=color_by,
263264
include_wireframe=wireframe, use_mesh=mesh, hide_color_by=hide_color_by,
264265
room_attrs=room_attributes, face_attrs=face_attributes,
265266
grid_display_mode=grid_display_mode, hide_grid=hide_grid)
@@ -279,9 +280,9 @@ def model_to_vis_set(
279280
'generated Honeybee Room objects or if full geometry objects should be '
280281
'written for each story in the building.', default=True, show_default=True)
281282
@click.option(
282-
'--no-plenum/--plenum', ' /-p', help='Flag to indicate whether '
283-
'ceiling/floor plenums should be auto-generated for the Rooms.',
284-
default=True, show_default=True)
283+
'--plenum/--no-plenum', '-p/-np', help='Flag to indicate whether '
284+
'ceiling/floor plenum depths assigned to Room2Ds should generate '
285+
'distinct 3D Rooms in the translation.', default=True, show_default=True)
285286
@click.option(
286287
'--no-ceil-adjacency/--ceil-adjacency', ' /-a', help='Flag to indicate '
287288
'whether adjacencies should be solved between interior stories when '
@@ -308,7 +309,7 @@ def model_to_vis_set(
308309
'file contents. By default, it will be printed out to stdout',
309310
type=click.File('w'), default='-', show_default=True)
310311
def model_comparison_to_vis_set_cli(
311-
base_model_file, incoming_model_file, multiplier, no_plenum, no_ceil_adjacency,
312+
base_model_file, incoming_model_file, multiplier, plenum, no_ceil_adjacency,
312313
base_color, incoming_color, output_format, output_file):
313314
"""Translate two Dragonfly Models to be compared to a VisualizationSet.
314315
@@ -327,12 +328,12 @@ def model_comparison_to_vis_set_cli(
327328
try:
328329
# process all of the CLI input so that it can be passed to the function
329330
full_geometry = not multiplier
330-
add_plenum = not no_plenum
331+
no_plenum = not plenum
331332
ceil_adjacency = not no_ceil_adjacency
332333

333334
# pass the input to the function in order to convert the model
334335
model_comparison_to_vis_set(
335-
base_model_file, incoming_model_file, full_geometry, add_plenum,
336+
base_model_file, incoming_model_file, full_geometry, no_plenum,
336337
ceil_adjacency, base_color, incoming_color, output_format, output_file)
337338
except Exception as e:
338339
_logger.exception('Failed to translate Model to VisualizationSet.\n{}'.format(e))
@@ -342,9 +343,10 @@ def model_comparison_to_vis_set_cli(
342343

343344

344345
def model_comparison_to_vis_set(
345-
base_model_file, incoming_model_file, full_geometry=False, plenum=False,
346+
base_model_file, incoming_model_file, full_geometry=False, no_plenum=False,
346347
ceil_adjacency=False, base_color='#74eded', incoming_color='#ed7474',
347348
output_format='vsf', output_file=None,
349+
multiplier=True, plenum=True, no_ceil_adjacency=True
348350
):
349351
"""Translate two Honeybee Models to be compared to a VisualizationSet.
350352
@@ -361,8 +363,9 @@ def model_comparison_to_vis_set(
361363
full_geometry: Boolean to note if the multipliers on each Story should
362364
be passed along to the generated Honeybee Room objects or if full
363365
geometry objects should be written for each story in the building.
364-
plenum: Boolean to indicate whether ceiling/floor plenums should
365-
be auto-generated for the Rooms. (Default: False).
366+
no_plenum: Boolean to indicate whether ceiling/floor plenum depths
367+
assigned to Room2Ds should generate distinct 3D Rooms in the
368+
translation. (Default: False).
366369
ceil_adjacency: Boolean to indicate whether adjacencies should be solved
367370
between interior stories when Room2D floor and ceiling geometries
368371
are coplanar. This ensures that Surface boundary conditions are used
@@ -394,7 +397,8 @@ def model_comparison_to_vis_set(
394397
# create the VisualizationSet
395398
multiplier = not full_geometry
396399
vis_set = base_model.to_vis_set_comparison(
397-
incoming_model, multiplier, plenum, ceil_adjacency, base_color, incoming_color)
400+
incoming_model, multiplier, no_plenum, ceil_adjacency,
401+
base_color, incoming_color)
398402

399403
# output the VisualizationSet through the CLI
400404
return _output_vis_set_to_format(vis_set, output_format, output_file)

dragonfly_display/model.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66

77
def model_to_vis_set(
8-
model, use_multiplier=True, add_plenum=False, solve_ceiling_adjacencies=False,
8+
model, use_multiplier=True, exclude_plenums=False,
9+
solve_ceiling_adjacencies=False,
910
color_by='type', include_wireframe=True, use_mesh=True,
1011
hide_color_by=False, room_attrs=None, face_attrs=None,
1112
grid_display_mode='Default', hide_grid=False):
@@ -19,8 +20,11 @@ def model_to_vis_set(
1920
will be multiplied. If False, full geometry objects will be written
2021
for each and every floor in the building that are represented through
2122
multipliers and all resulting multipliers will be 1. (Default: True).
22-
add_plenum: Boolean to indicate whether ceiling/floor plenums should
23-
be auto-generated for the Rooms. (Default: False).
23+
exclude_plenums: Boolean to indicate whether ceiling/floor plenum depths
24+
assigned to Room2Ds should be ignored during translation. This
25+
results in each Room2D translating to a single Honeybee Room at
26+
the full floor_to_ceiling_height instead of a base Room with (a)
27+
plenum Room(s). (Default: False).
2428
solve_ceiling_adjacencies: Boolean to note whether adjacencies should be
2529
solved between interior stories when Room2D floor and ceiling
2630
geometries are coplanar. This ensures that Surface boundary
@@ -73,7 +77,7 @@ def model_to_vis_set(
7377
"""
7478
# create the Honeybee Model from the Dragonfly one
7579
hb_model = model.to_honeybee(
76-
'District', use_multiplier=use_multiplier, add_plenum=add_plenum,
80+
'District', use_multiplier=use_multiplier, exclude_plenums=exclude_plenums,
7781
solve_ceiling_adjacencies=solve_ceiling_adjacencies,
7882
enforce_adj=False, enforce_solid=True)[0]
7983
# convert the Honeybee Model to a VisualizationSet
@@ -83,7 +87,7 @@ def model_to_vis_set(
8387

8488

8589
def model_comparison_to_vis_set(
86-
base_model, incoming_model, use_multiplier=True, add_plenum=False,
90+
base_model, incoming_model, use_multiplier=True, exclude_plenums=False,
8791
solve_ceiling_adjacencies=False, base_color=None, incoming_color=None):
8892
"""Translate two Dragonfly Models to be compared to a VisualizationSet.
8993
@@ -99,8 +103,11 @@ def model_comparison_to_vis_set(
99103
will be multiplied. If False, full geometry objects will be written
100104
for each and every floor in the building that are represented through
101105
multipliers and all resulting multipliers will be 1. (Default: True).
102-
add_plenum: Boolean to indicate whether ceiling/floor plenums should
103-
be auto-generated for the Rooms. (Default: False).
106+
exclude_plenums: Boolean to indicate whether ceiling/floor plenum depths
107+
assigned to Room2Ds should be ignored during translation. This
108+
results in each Room2D translating to a single Honeybee Room at
109+
the full floor_to_ceiling_height instead of a base Room with (a)
110+
plenum Room(s). (Default: False).
104111
solve_ceiling_adjacencies: Boolean to note whether adjacencies should be
105112
solved between interior stories when Room2D floor and ceiling
106113
geometries are coplanar. This ensures that Surface boundary
@@ -113,11 +120,11 @@ def model_comparison_to_vis_set(
113120
"""
114121
# create the Honeybee Models from the Dragonfly ones
115122
base_model = base_model.to_honeybee(
116-
'District', use_multiplier=use_multiplier, add_plenum=add_plenum,
123+
'District', use_multiplier=use_multiplier, exclude_plenums=exclude_plenums,
117124
solve_ceiling_adjacencies=solve_ceiling_adjacencies,
118125
enforce_adj=False, enforce_solid=True)[0]
119126
incoming_model = incoming_model.to_honeybee(
120-
'District', use_multiplier=use_multiplier, add_plenum=add_plenum,
127+
'District', use_multiplier=use_multiplier, exclude_plenums=exclude_plenums,
121128
solve_ceiling_adjacencies=solve_ceiling_adjacencies,
122129
enforce_adj=False, enforce_solid=True)[0]
123130
# convert the Honeybee Model to a VisualizationSet

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
honeybee-display>=0.5.1
2-
dragonfly-core>=1.57.4
1+
honeybee-display>=0.5.3
2+
dragonfly-core>=1.59.1

tests/cli_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,3 @@ def test_model_comparison_to_vis_set():
7373

7474
assert isinstance(vtkjs_str, str)
7575
assert len(vtkjs_str) > 1000
76-

0 commit comments

Comments
 (0)