Skip to content

Commit 2b739d0

Browse files
authored
Merge pull request #63 from audunarn/dev
Updated documentation an example
2 parents 262934e + fbff186 commit 2b739d0

File tree

6 files changed

+29
-19
lines changed

6 files changed

+29
-19
lines changed
115 KB
Binary file not shown.

ANYstructure/main_application.py

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,19 @@ def show_message():
931931
self.update_frame()
932932

933933
def resize(self, event):
934-
pass
934+
self.text_scale = self._main_fr.winfo_width()/1920
935+
self._text_size = {'Text 14 bold': 'Verdana '+str(int(14*self.text_scale))+' bold',
936+
'Text 16 bold': 'Verdana ' + str(int(16 * self.text_scale)) + ' bold',
937+
'Text 18 bold': 'Verdana ' + str(int(18 * self.text_scale)) + ' bold',
938+
'Text 12 bold': 'Verdana ' + str(int(12 * self.text_scale)) + ' bold',
939+
'Text 10 bold': 'Verdana '+str(int(10*self.text_scale))+' bold',
940+
'Text 9 bold': 'Verdana ' + str(int(9 * self.text_scale)) + ' bold',
941+
'Text 8 bold': 'Verdana ' + str(int(8 * self.text_scale)) + ' bold',
942+
'Text 8': 'Verdana ' + str(int(8 * self.text_scale)),
943+
'Text 9': 'Verdana ' + str(int(8 * self.text_scale)),
944+
'Text 7': 'Verdana ' + str(int(7 * self.text_scale)),
945+
'Text 10': 'Verdana ' + str(int(10 * self.text_scale)),
946+
'Text 7 bold': 'Verdana ' + str(int(7 * self.text_scale)) + ' bold'}
935947

936948
def gui_load_combinations(self,event):
937949
'''
@@ -1673,44 +1685,44 @@ def color_code_text(self, state):
16731685
anchor="nw")
16741686
elif self._new_colorcode_sigmax.get() == True:
16751687
for idx, value in enumerate(cc_state['sigma x map']):
1676-
self._main_canvas.create_text(11, 111+20*idx, text=str(str(value) + ' MPa'),
1688+
self._main_canvas.create_text(11, 111+20*idx, text=str(str(round(value,5)) + ' MPa'),
16771689
font=self._text_size["Text 10 bold"],
16781690
fill='black',
16791691
anchor="nw")
1680-
self._main_canvas.create_text(10, 110+20*idx, text=str(str(value) + ' MPa'),
1692+
self._main_canvas.create_text(10, 110+20*idx, text=str(str(round(value,5)) + ' MPa'),
16811693
font=self._text_size["Text 10 bold"],
16821694
fill=matplotlib.colors.rgb2hex(
16831695
cmap_sections(value/cc_state['max sigma x'])),
16841696
anchor="nw")
16851697
elif self._new_colorcode_sigmay1.get() == True:
16861698
for idx, value in enumerate(cc_state['sigma y1 map']):
1687-
self._main_canvas.create_text(11, 111+20*idx, text=str(str(value) + ' MPa'),
1699+
self._main_canvas.create_text(11, 111+20*idx, text=str(str(round(value,5)) + ' MPa'),
16881700
font=self._text_size["Text 10 bold"],
16891701
fill='black',
16901702
anchor="nw")
1691-
self._main_canvas.create_text(10, 110+20*idx, text=str(str(value) + ' MPa'),
1703+
self._main_canvas.create_text(10, 110+20*idx, text=str(str(round(value,5)) + ' MPa'),
16921704
font=self._text_size["Text 10 bold"],
16931705
fill=matplotlib.colors.rgb2hex(
16941706
cmap_sections(value/cc_state['max sigma y1'])),
16951707
anchor="nw")
16961708
elif self._new_colorcode_sigmay2.get() == True:
16971709
for idx, value in enumerate(cc_state['sigma y2 map']):
1698-
self._main_canvas.create_text(11, 111+20*idx, text=str(str(value) + ' MPa'),
1710+
self._main_canvas.create_text(11, 111+20*idx, text=str(str(round(value,5)) + ' MPa'),
16991711
font=self._text_size["Text 10 bold"],
17001712
fill='black',
17011713
anchor="nw")
1702-
self._main_canvas.create_text(10, 110+20*idx, text=str(str(value) + ' MPa'),
1714+
self._main_canvas.create_text(10, 110+20*idx, text=str(str(round(value,5)) + ' MPa'),
17031715
font=self._text_size["Text 10 bold"],
17041716
fill=matplotlib.colors.rgb2hex(
17051717
cmap_sections(value/cc_state['max sigma y2'])),
17061718
anchor="nw")
17071719
elif self._new_colorcode_tauxy.get() == True:
17081720
for idx, value in enumerate(cc_state['tau xy map']):
1709-
self._main_canvas.create_text(11, 111+20*idx, text=str(str(value) + ' MPa'),
1721+
self._main_canvas.create_text(11, 111+20*idx, text=str(str(round(value,5)) + ' MPa'),
17101722
font=self._text_size["Text 10 bold"],
17111723
fill='black',
17121724
anchor="nw")
1713-
self._main_canvas.create_text(10, 110+20*idx, text=str(str(value) + ' MPa'),
1725+
self._main_canvas.create_text(10, 110+20*idx, text=str(str(round(value,5)) + ' MPa'),
17141726
font=self._text_size["Text 10 bold"],
17151727
fill=matplotlib.colors.rgb2hex(
17161728
cmap_sections(value/cc_state['max tau xy'])),
@@ -1783,7 +1795,7 @@ def draw_prop(self):
17831795

17841796
# printing the properties to the active line
17851797
if self._line_is_active:
1786-
self._prop_canvas.create_text([170*self._global_shrink, 120*self._global_shrink],
1798+
self._prop_canvas.create_text([175*self._global_shrink, 120*self._global_shrink],
17871799
text=self._line_to_struc[self._active_line][0],
17881800
font = self._text_size["Text 9"])
17891801

@@ -1870,7 +1882,7 @@ def draw_results(self, state = None):
18701882

18711883
if self._line_is_active:
18721884
if self._active_line in self._line_to_struc:
1873-
x, y, dx, dy = 20, 15, 15, 14
1885+
x, y, dx, dy = 0, 15, 15, 14
18741886
m3_to_mm3 = float(math.pow(1000,3))
18751887
m2_to_mm2 = float(math.pow(1000, 2))
18761888

@@ -1945,13 +1957,13 @@ def draw_results(self, state = None):
19451957

19461958
#minimum thickness for plate
19471959

1948-
self._result_canvas.create_text([20*self._global_shrink, (y+6*dy)*self._global_shrink],
1960+
self._result_canvas.create_text([x*self._global_shrink, (y+6*dy)*self._global_shrink],
19491961
text='Plate thickness: '
19501962
+str(obj_structure.get_plate_thk()*1000)+' [mm] ',
19511963
font=self._text_size["Text 9 bold"],anchor='nw')
19521964
text = 'Minimum plate thickness: '+str(round(min_thk,1)) + ' [mm]' if not slm_text_pl_thk \
19531965
else 'Minimum plate thickness due to SLAMMING'+str(slm_min_pl_thk)+' [mm]'
1954-
self._result_canvas.create_text([20*self._global_shrink, (y+7*dy)*self._global_shrink],
1966+
self._result_canvas.create_text([x*self._global_shrink, (y+7*dy)*self._global_shrink],
19551967
text=text,
19561968
font=self._text_size["Text 9 bold"],anchor='nw', fill=color_thk)
19571969

@@ -3530,9 +3542,6 @@ def on_close_load_window(self, returned_loads, counter, load_comb_dict):
35303542

35313543
for main_line in self._line_dict.keys():
35323544
for load_obj, load_line in self._load_dict.values():
3533-
# print(load_line, self._line_to_struc.keys())
3534-
# if load_line not in self._line_to_struc.keys():
3535-
# continue
35363545
if main_line in load_line and main_line in self._line_to_struc.keys():
35373546
self._line_to_struc[main_line][3].append(load_obj)
35383547

ANYstructure/optimize_multiple_window.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,12 +1105,14 @@ def right_click(self,event):
11051105
:param evnet:
11061106
:return:
11071107
'''
1108+
11081109
self._previous_drag_mouse = [event.x, event.y]
11091110
self._active_lines = []
11101111
self._canvas_select.delete('all')
11111112
self.draw_select_canvas()
11121113
self.update_running_time()
11131114

1115+
11141116
def mid_click(self,event):
11151117
'''
11161118
Event when right click.

ANYstructure/report_generator.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,6 @@ def draw_lines(self, draw_type = 'UF'):
476476
textobject.setFillColor('black')
477477
textobject.textLine('Global stresses - sigma x')
478478
self.c.drawText(textobject)
479-
print(all_line_data['color code']['sigma x map'])
480479
for idx, value in enumerate(list(all_line_data['color code']['sigma x map'])):
481480
textobject = self.c.beginText()
482481
if 400 - 20 * idx > 20:

ANYstructure/ship_section_example.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def readme():
2727
name='ANYstructure', # Required
2828
url = 'https://github.com/audunarn/ANYstructure',
2929
entry_points={'gui_scripts': ['ANYstructure = ANYstructure.__main__:main']},
30-
version=2.4, # Required
30+
version=2.5, # Required
3131
license='MIT',
3232
description='A plate field optimization tool for offshore structures calculated according to DNVGL standards',
3333
long_description = readme(),

0 commit comments

Comments
 (0)