Skip to content

Commit 67125c6

Browse files
chriswmackeyChris Mackey
authored andcommitted
fix(model): Add an option to hide the color-by geometry
This will be useful for visualizations where the first thing we want the user to see is an AnalysisGeometry in relation to the model Wireframe.
1 parent 6251aae commit 67125c6

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

extras-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
honeybee-energy>=1.95.19
22
honeybee-radiance>=1.64.105
3-
ladybug-vtk>=0.10.0
3+
ladybug-vtk>=0.11.1

honeybee_display/cli/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def display():
4242
'(meaning that their wireframe in certain platforms might not appear ideal). '
4343
'Also, merging the geometry into a single mesh means interfaces cannot support '
4444
'the selection of individual Face3D geometries.', default=True, show_default=True)
45+
@click.option(
46+
'--show-color-by/--hide-color-by', ' /-hcb', help='Flag to note whether the '
47+
'color-by geometry should be hidden or shown by default. Hiding the color-by '
48+
'geometry is useful when the primary purpose of the visualization is to display '
49+
'grid-data or room/face attributes but it is still desirable to have the option '
50+
'to turn on the geometry.', default=True, show_default=True)
4551
@click.option(
4652
'--room-attr', '-r', help='An optional text string of an attribute that the Model '
4753
'Rooms have, which will be used to construct a visualization of this attribute '
@@ -97,17 +103,19 @@ def display():
97103
'the config object. By default, it will be printed out to stdout',
98104
type=click.File('w'), default='-', show_default=True)
99105
def model_to_vis_set(
100-
model_file, color_by, wireframe, mesh, room_attr, face_attr, color_attr,
106+
model_file, color_by, wireframe, mesh, show_color_by,
107+
room_attr, face_attr, color_attr,
101108
grid_data, grid_display_mode, output_format, output_file):
102109
"""Get a JSON object with all configuration information"""
103110
try:
104111
model_obj = Model.from_file(model_file)
105112
room_attr = None if len(room_attr) == 0 or room_attr[0] == '' else room_attr
106113
face_attr = None if len(face_attr) == 0 or face_attr[0] == '' else face_attr
107114
text_labels = not color_attr
115+
hide_color_by = not show_color_by
108116
vis_set = model_obj.to_vis_set(
109117
color_by=color_by, include_wireframe=wireframe, use_mesh=mesh,
110-
room_attr=room_attr, face_attr=face_attr,
118+
hide_color_by=hide_color_by, room_attr=room_attr, face_attr=face_attr,
111119
room_text_labels=text_labels, face_text_labels=text_labels,
112120
grid_data_path=grid_data, grid_display_mode=grid_display_mode)
113121
output_format = output_format.lower()

honeybee_display/model.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141

4242
def model_to_vis_set(
4343
model, color_by='type', include_wireframe=True, use_mesh=True,
44-
room_attr=None, face_attr=None, room_text_labels=False, face_text_labels=False,
44+
hide_color_by=False, room_attr=None, face_attr=None,
45+
room_text_labels=False, face_text_labels=False,
4546
room_legend_par=None, face_legend_par=None,
4647
grid_data_path=None, grid_display_mode='Surface'):
4748
"""Translate a Honeybee Model to a VisualizationSet.
@@ -69,6 +70,11 @@ def model_to_vis_set(
6970
(meaning that their wireframe in certain platforms might not appear ideal)
7071
and they cannot support the selection of individual Face3D geometries
7172
in the resulting visualization. (Default: True).
73+
hide_color_by: Boolean to note whether the color_by geometry should be
74+
hidden or shown by default. Hiding the color-by geometry is useful
75+
when the primary purpose of the visualization is to display grid_data
76+
or room/face attributes but it is still desirable to have the option
77+
to turn on the geometry.
7278
room_attr: An optional text string of an attribute that the Model Rooms have,
7379
which will be used to construct a visualization of this attribute in the
7480
resulting VisualizationSet. This can also be a list of attribute strings and
@@ -229,6 +235,8 @@ def model_to_vis_set(
229235
for geo in geometries:
230236
dis_geos.append(DisplayFace3D(geo, col))
231237
con_geo = ContextGeometry(geo_id.replace(' ', '_'), dis_geos)
238+
if hide_color_by:
239+
con_geo.hidden = True
232240
con_geo.display_name = geo_id
233241
geo_objs.append(con_geo)
234242

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
ladybug-display>=0.6.7
2-
honeybee-core>=1.54.6
1+
ladybug-display>=0.6.10
2+
honeybee-core>=1.54.10

0 commit comments

Comments
 (0)