@@ -177,7 +177,9 @@ def __init__(self, parent):
177
177
# 'line1':[Structure,CalcScantlings,Fatigue,Load,Combinations]
178
178
self ._tank_dict = {} # Main tank dictionary (created when BFS search is executed for the grid) (comp# : TankObj)
179
179
self ._load_dict = {} # Main load dictionary (created in separate load window (load# : [LoadObj, lines])
180
- self ._new_load_comb_dict = {} # Load combination dict.(comb,line,load) : [DoubleVar(), DoubleVar], IntVar()]
180
+ self ._new_load_comb_dict = {} # Load combination dict.(comb,line,load) : [DoubleVar(), DoubleVar(), IntVar()]
181
+ # Example ('dnva', 'line25', 'comp3'), ('dnvb', 'line14', 'comp4'),
182
+ # ('manual', 'line74', 'manual'), ('tanktest', 'line76', 'comp3')
181
183
self ._sections = list () # A list containing section property objects.
182
184
#
183
185
# -------------------------------------------------------------------------------------------------------------
@@ -1406,25 +1408,29 @@ def gui_load_combinations(self,event):
1406
1408
self ._manual_created [3 ].place (relx = lc_x + 7 * lc_x_delta , rely = lc_y )
1407
1409
1408
1410
#printing the results
1409
- try :
1410
- results = self .calculate_all_load_combinations_for_line (self ._active_line )
1411
- self ._result_label_dnva .config (text = 'DNV a [Pa]: ' + str (results ['dnva' ]),
1412
- font = self ._text_size ['Text 8' ])
1413
- self ._result_label_dnvb .config (text = 'DNV b [Pa]: ' + str (results ['dnvb' ]),
1411
+
1412
+ #try:
1413
+ # TODO the reason manual does not show is because it others do noe exist in line_comb_dict. FIX.
1414
+ results = self .calculate_all_load_combinations_for_line (self ._active_line )
1415
+
1416
+ self ._result_label_dnva .config (text = 'DNV a [Pa]: ' + str (results ['dnva' ]),
1417
+ font = self ._text_size ['Text 8' ])
1418
+ self ._result_label_dnvb .config (text = 'DNV b [Pa]: ' + str (results ['dnvb' ]),
1419
+ font = self ._text_size ['Text 8' ])
1420
+ self ._result_label_tanktest .config (text = 'TT [Pa]: ' + str (results ['tanktest' ]),
1414
1421
font = self ._text_size ['Text 8' ])
1415
- self ._result_label_tanktest .config (text = 'TT [Pa]: ' + str (results ['tanktest' ]),
1416
- font = self ._text_size ['Text 8' ])
1417
1422
1418
- self ._result_label_manual .config (text = 'Manual [Pa]: ' + str (results ['manual' ]))
1423
+ self ._result_label_manual .config (text = 'Manual [Pa]: ' + str (results ['manual' ]))
1419
1424
1420
- lc_y = self .results_gui_start + 0.018518519
1421
- self ._result_label_dnva .place (relx = lc_x + 0 * lc_x_delta , rely = lc_y + lc_y_delta * 1.5 )
1422
- self ._result_label_dnvb .place (relx = lc_x + 4 * lc_x_delta , rely = lc_y + lc_y_delta * 1.5 )
1423
- self ._result_label_tanktest .place (relx = lc_x + 0 * lc_x_delta , rely = lc_y + 2.4 * lc_y_delta )
1425
+ lc_y = self .results_gui_start + 0.018518519
1426
+ self ._result_label_dnva .place (relx = lc_x + 0 * lc_x_delta , rely = lc_y + lc_y_delta * 1.5 )
1427
+ self ._result_label_dnvb .place (relx = lc_x + 4 * lc_x_delta , rely = lc_y + lc_y_delta * 1.5 )
1428
+ self ._result_label_tanktest .place (relx = lc_x + 0 * lc_x_delta , rely = lc_y + 2.4 * lc_y_delta )
1429
+
1430
+ self ._result_label_manual .place (relx = lc_x + 4 * lc_x_delta , rely = lc_y + 2.4 * lc_y_delta )
1431
+ # except KeyError:
1432
+ # pass
1424
1433
1425
- self ._result_label_manual .place (relx = lc_x + 4 * lc_x_delta , rely = lc_y + 2.4 * lc_y_delta )
1426
- except KeyError :
1427
- pass
1428
1434
1429
1435
def slider_used (self , event ):
1430
1436
'''
@@ -1575,15 +1581,15 @@ def add_to_combinations_dict(self,line):
1575
1581
self ._new_load_comb_dict [name ][0 ].set (self ._load_factors_dict [combination ][1 ])
1576
1582
self ._new_load_comb_dict [name ][1 ].set (self ._load_factors_dict [combination ][2 ])
1577
1583
self ._new_load_comb_dict [name ][2 ].set (1 )
1578
-
1579
- name = ('manual' , line ,'manual' )
1580
- self ._new_load_comb_dict [name ] = [tk .DoubleVar (), tk .DoubleVar (), tk .IntVar ()]
1581
- self ._new_load_comb_dict [name ][0 ].set (0 )
1582
- self ._new_load_comb_dict [name ][1 ].set (0 )
1583
- self ._new_load_comb_dict [name ][2 ].set (0 )
1584
1584
else :
1585
1585
pass
1586
1586
1587
+ name = ('manual' , line , 'manual' )
1588
+ self ._new_load_comb_dict [name ] = [tk .DoubleVar (), tk .DoubleVar (), tk .IntVar ()]
1589
+ self ._new_load_comb_dict [name ][0 ].set (0 )
1590
+ self ._new_load_comb_dict [name ][1 ].set (0 )
1591
+ self ._new_load_comb_dict [name ][2 ].set (0 )
1592
+
1587
1593
def trace_acceptance_change (self , * args ):
1588
1594
try :
1589
1595
self .update_frame ()
@@ -2162,7 +2168,8 @@ def color_code_text(self, state):
2162
2168
anchor = "nw" )
2163
2169
self ._main_canvas .create_text (10 , start_text + 20 * idx , text = str (str (press ) + ' Pa' ),
2164
2170
font = self ._text_size ["Text 10 bold" ],
2165
- fill = matplotlib .colors .rgb2hex (cmap_sections (press / highest_pressure )),
2171
+ fill = matplotlib .colors .rgb2hex (cmap_sections (0 if highest_pressure == 0
2172
+ else press / highest_pressure )),
2166
2173
anchor = "nw" )
2167
2174
2168
2175
elif all ([self ._new_colorcode_utilization .get () == True ,
@@ -2385,15 +2392,15 @@ def color_code_line(self, state, line, coord1, vector):
2385
2392
color = 'blue' if state ['color code' ]['lines' ][line ]['PULS method' ] == 'ultimate' else 'red'
2386
2393
if self ._new_label_color_coding .get ():
2387
2394
self ._main_canvas .create_text (coord1 [0 ] + vector [0 ] / 2 + 5 , coord1 [1 ] + vector [1 ] / 2 - 10 ,
2388
- text = round ( state ['color code' ]['lines' ][line ]['PULS method' ], 2 ) )
2395
+ text = state ['color code' ]['lines' ][line ]['PULS method' ])
2389
2396
elif self ._new_colorcode_puls_sp_or_up .get ():
2390
2397
if state ['color code' ]['lines' ][line ]['PULS sp or up' ] == None :
2391
2398
color = 'black'
2392
2399
else :
2393
2400
color = 'blue' if state ['color code' ]['lines' ][line ]['PULS sp or up' ] == 'SP' else 'red'
2394
2401
if self ._new_label_color_coding .get ():
2395
2402
self ._main_canvas .create_text (coord1 [0 ] + vector [0 ] / 2 + 5 , coord1 [1 ] + vector [1 ] / 2 - 10 ,
2396
- text = round ( state ['color code' ]['lines' ][line ]['PULS sp or up' ], 2 ) )
2403
+ text = state ['color code' ]['lines' ][line ]['PULS sp or up' ])
2397
2404
else :
2398
2405
color = 'black'
2399
2406
@@ -3074,6 +3081,8 @@ def calculate_all_load_combinations_for_line(self, line, limit_state = 'ULS', ge
3074
3081
results = {} #dict - dnva/dnvb/tanktest/manual
3075
3082
load_info = []
3076
3083
# calculating for DNV a and DNV b
3084
+
3085
+
3077
3086
for dnv_ab in ['dnva' , 'dnvb' ]: #, load_factors in self._load_factors_dict.items():
3078
3087
results [dnv_ab ] = []
3079
3088
for load_condition in self ._load_conditions [0 :2 ]:
@@ -3088,6 +3097,7 @@ def calculate_all_load_combinations_for_line(self, line, limit_state = 'ULS', ge
3088
3097
results ['tanktest' ].append (res_val [0 ])
3089
3098
[load_info .append (val ) for val in res_val [1 ]]
3090
3099
3100
+
3091
3101
# calculating for manual condition
3092
3102
results ['manual' ] = []
3093
3103
res_val = self .calculate_one_load_combination (line , 'manual' , 'manual' )
@@ -4339,6 +4349,7 @@ def on_close_load_window(self, returned_loads, counter, load_comb_dict):
4339
4349
Setting properties created in load window.
4340
4350
:return:
4341
4351
'''
4352
+
4342
4353
try :
4343
4354
img_file_name = 'img_ext_pressure_button.gif'
4344
4355
if os .path .isfile ('images/' + img_file_name ):
0 commit comments