@@ -72,9 +72,17 @@ def display():
72
72
'one another. For example, properties.energy.construction.' ,
73
73
type = click .STRING , multiple = True , default = None , show_default = True )
74
74
@click .option (
75
- '--color-attr/--text-attr' , help = 'Flag to note whether to note whether the '
76
- 'input room-attr and face-attr should be expressed as a colored AnalysisGeometry '
77
- 'or a ContextGeometry as text labels.' , default = True , show_default = True )
75
+ '--color-attr' , 'attr_display' , flag_value = 'color' , help = 'Flag to note whether the '
76
+ 'input room-attr and face-attr should be expressed as a colored AnalysisGeometry.' ,
77
+ default = True , show_default = True )
78
+ @click .option (
79
+ '--text-attr' , 'attr_display' , flag_value = 'text' , help = 'Flag to note whether the '
80
+ 'input room-attr and face-attr should be expressed as a ContextGeometry with '
81
+ 'text labels.' )
82
+ @click .option (
83
+ '--both-attr' , 'attr_display' , flag_value = 'both' , help = 'Flag to note whether the '
84
+ 'input room-attr and face-attr should be expressed as both a colored AnalysisGeometry '
85
+ 'and a ContextGeometry with text labels.' )
78
86
@click .option (
79
87
'--grid-display-mode' , '-m' , help = 'Text that dictates how the ContextGeometry '
80
88
'for Model SensorGrids should display in the resulting visualization. The Default '
@@ -127,7 +135,7 @@ def display():
127
135
type = click .File ('w' ), default = '-' , show_default = True )
128
136
def model_to_vis_set_cli (
129
137
model_file , color_by , wireframe , mesh , show_color_by ,
130
- room_attr , face_attr , color_attr , grid_display_mode , hide_grid ,
138
+ room_attr , face_attr , attr_display , grid_display_mode , hide_grid ,
131
139
grid_data , grid_data_display_mode , active_grid_data , output_format , output_file ):
132
140
"""Translate a Honeybee Model file (.hbjson) to a VisualizationSet file (.vsf).
133
141
@@ -145,14 +153,19 @@ def model_to_vis_set_cli(
145
153
hide_color_by = not show_color_by
146
154
room_attrs = [] if len (room_attr ) == 0 or room_attr [0 ] == '' else room_attr
147
155
face_attrs = [] if len (face_attr ) == 0 or face_attr [0 ] == '' else face_attr
148
- text_labels = not color_attr
149
156
show_grid = not hide_grid
157
+ if attr_display == 'color' :
158
+ color_attr , text_attr , both_attr = True , False , False
159
+ elif attr_display == 'text' :
160
+ color_attr , text_attr , both_attr = False , True , False
161
+ elif attr_display == 'both' :
162
+ color_attr , text_attr , both_attr = False , False , True
150
163
151
164
# pass the input to the function in order to convert the model to a visualization
152
165
model_to_vis_set (model_file , color_by , exclude_wireframe , faces , hide_color_by ,
153
- room_attrs , face_attrs , text_labels , grid_display_mode ,
166
+ room_attrs , face_attrs , text_attr , both_attr , grid_display_mode ,
154
167
show_grid , grid_data , grid_data_display_mode , active_grid_data ,
155
- output_format , output_file )
168
+ output_format , output_file , color_attr = color_attr )
156
169
except Exception as e :
157
170
_logger .exception ('Failed to translate Model to VisualizationSet.\n {}' .format (e ))
158
171
sys .exit (1 )
@@ -163,9 +176,10 @@ def model_to_vis_set_cli(
163
176
def model_to_vis_set (
164
177
model_file , color_by = 'type' ,
165
178
exclude_wireframe = False , faces = False , hide_color_by = False ,
166
- room_attr = (), face_attr = (), text_attr = False , grid_display_mode = 'Default' ,
167
- show_grid = False , grid_data = None , grid_data_display_mode = 'Surface' ,
168
- active_grid_data = None , output_format = 'vsf' , output_file = None ,
179
+ room_attr = (), face_attr = (), text_attr = False , both_attr = False ,
180
+ grid_display_mode = 'Default' , show_grid = False , grid_data = None ,
181
+ grid_data_display_mode = 'Surface' , active_grid_data = None ,
182
+ output_format = 'vsf' , output_file = None ,
169
183
wireframe = True , mesh = True , show_color_by = True , color_attr = True , hide_grid = True
170
184
):
171
185
"""Translate a Honeybee Model file (.hbjson) to a VisualizationSet file (.vsf).
@@ -211,8 +225,10 @@ def model_to_vis_set(
211
225
here can have . that separates the nested attributes from one another.
212
226
For example, properties.energy.construction.
213
227
text_attr: Boolean to note whether to note whether the input room_attr
214
- and face_attr should be expressed as a colored AnalysisGeometry
215
- or a ContextGeometry as text labels.
228
+ and face_attr should be expressed as a ContextGeometry with text labels.
229
+ both_attr: Boolean to note whether to note whether the input room_attr
230
+ and face_attr should be expressed as both a colored AnalysisGeometry
231
+ and a ContextGeometry as text labels.
216
232
grid_display_mode: Text that dictates how the ContextGeometry for Model
217
233
SensorGrids should display in the resulting visualization. The Default
218
234
option will draw sensor points whenever there is no grid_data_path
@@ -263,10 +279,13 @@ def model_to_vis_set(
263
279
face_attrs = [face_attr ] if isinstance (face_attr , str ) else face_attr
264
280
wireframe = not exclude_wireframe
265
281
mesh = not faces
266
- color_attr = not text_attr
267
282
hide_grid = not show_grid
268
283
269
284
# load the room and face attributes
285
+ if both_attr :
286
+ color_attr , text_attr = True , True
287
+ elif text_attr :
288
+ color_attr = False
270
289
face_attributes = []
271
290
for fa in face_attrs :
272
291
faa = FaceAttribute (name = fa , attrs = [fa ], color = color_attr , text = text_attr )
0 commit comments