@@ -183,13 +183,16 @@ def export_reports(bldg_data, bldg_name, path, prj):
183
183
output_path_base = os .path .join (path , base_name )
184
184
plotly_file_name = os .path .join (path , "plots" , base_name + "_plotly.html" )
185
185
# Draw an abstract image of the building and save it with plotly to HTML
186
- interactive_fig = create_simple_3d_visualization (bldg_data , roof_angle = 30 )
186
+ interactive_fig , fixed_height = \
187
+ create_simple_3d_visualization (bldg_data , roof_angle = 30 )
187
188
if interactive_fig :
188
189
interactive_fig .write_html (plotly_file_name )
189
190
else :
190
191
plotly_file_name = None
191
192
html_file_name = os .path .join (output_path_base + ".html" )
192
- create_html_page (bldg_data , prj .name , bldg_name , html_file_name , plotly_file_name )
193
+ create_html_page (
194
+ bldg_data , prj .name , bldg_name , html_file_name , plotly_file_name ,
195
+ fixed_height )
193
196
create_csv_report (bldg_data , output_path_base )
194
197
195
198
@@ -235,7 +238,9 @@ def create_csv_report(bldg_data, output_path_base):
235
238
]
236
239
# round values
237
240
for key , value in prj_data_flat .items ():
238
- if not isinstance (value , str ):
241
+ if not value :
242
+ value = "-"
243
+ elif not isinstance (value , str ):
239
244
prj_data_flat [key ] = round (value , 2 )
240
245
else :
241
246
prj_data_flat [key ] = value
@@ -312,7 +317,8 @@ def add_compass_to_3d_plot(fig, x_y_axis_sizing):
312
317
return fig
313
318
314
319
315
- def create_html_page (bldg_data , prj_name , bldg_name , html_file_name , iframe_src ):
320
+ def create_html_page (bldg_data , prj_name , bldg_name , html_file_name ,
321
+ iframe_src , fixed_height ):
316
322
html_content = f"""
317
323
<!DOCTYPE html>
318
324
<html>
@@ -459,7 +465,10 @@ def create_html_page(bldg_data, prj_name, bldg_name, html_file_name, iframe_src)
459
465
<th scope="row">{ html .escape (key_human_readable )} </th>
460
466
"""
461
467
if not isinstance (value , str ):
462
- value = str (round (value , 2 ))
468
+ if value :
469
+ value = str (round (value , 2 ))
470
+ else :
471
+ value = "-"
463
472
if not list_item :
464
473
html_content += f"""
465
474
<td>{ html .escape (value )} </td>
@@ -508,7 +517,11 @@ def create_html_page(bldg_data, prj_name, bldg_name, html_file_name, iframe_src)
508
517
<li><i>Only works for buildings with 4 directions currently,
509
518
while the smallest will be interpreted as
510
519
north, the next bigger one as east and so on.</i></li>
511
- <li><i>The roof is not displayed correctly yet</i></li>
520
+ <li><i>The roof is not displayed correctly yet</i></li>"""
521
+ if fixed_height :
522
+ html_content += f"""<li><i>The height of all floors is assumed to be 3
523
+ meters.</i></li>"""
524
+ html_content += f"""
512
525
</div>
513
526
</div>
514
527
</div>
@@ -561,6 +574,10 @@ def get_value_with_default(lst, index, default_value):
561
574
window_area_south = get_value_with_default (window_values , 2 , 0 )
562
575
window_area_west = get_value_with_default (window_values , 3 , 0 )
563
576
height = bldg_data ["Floor Height" ]
577
+ fixed_height = False
578
+ if not height :
579
+ height = 3
580
+ fixed_height = True
564
581
num_floors = bldg_data ["Number of Floors" ]
565
582
566
583
length_north = area_north / (num_floors * height )
@@ -754,7 +771,7 @@ def get_value_with_default(lst, index, default_value):
754
771
)
755
772
)
756
773
757
- return fig
774
+ return fig , fixed_height
758
775
except Exception as e :
759
776
message = type (e ).__name__ + str (e .args )
760
777
print (
0 commit comments