ANYstructure 5.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- anystruct/ANYstructure_documentation.pdf +0 -0
- anystruct/SN_curve_parameters.py +35 -0
- anystruct/__init__.py +0 -0
- anystruct/__main__.py +24 -0
- anystruct/api.py +772 -0
- anystruct/buckling_calc_external.py +120 -0
- anystruct/bulb_anglebar_tbar_flatbar.csv +677 -0
- anystruct/calc_loads.py +526 -0
- anystruct/calc_structure.py +4838 -0
- anystruct/compartment_window.py +176 -0
- anystruct/example_data.py +532 -0
- anystruct/example_data_puls.py +46 -0
- anystruct/excel_inteface.py +244 -0
- anystruct/fatigue_window.py +352 -0
- anystruct/grid_window.py +307 -0
- anystruct/gui.py +24 -0
- anystruct/helper.py +623 -0
- anystruct/images/ANYstructure_logo.jpg +0 -0
- anystruct/images/Buckling_Strength_of_Shells.png +0 -0
- anystruct/images/Panel_geometry_definitions.png +0 -0
- anystruct/images/current_comps_NONE.png +0 -0
- anystruct/images/fls_button.gif +0 -0
- anystruct/images/img_T_L_FB.gif +0 -0
- anystruct/images/img_axial_stresses.gif +0 -0
- anystruct/images/img_ext_pressure_button.gif +0 -0
- anystruct/images/img_ext_pressure_button_def.gif +0 -0
- anystruct/images/img_fixation_parameters.gif +0 -0
- anystruct/images/img_generate_report.gif +0 -0
- anystruct/images/img_int_pressure_button.gif +0 -0
- anystruct/images/img_int_pressure_button_search.gif +0 -0
- anystruct/images/img_multi_opt.gif +0 -0
- anystruct/images/img_optimize.gif +0 -0
- anystruct/images/img_plate_and_stiffener.gif +0 -0
- anystruct/images/img_stf_button.gif +0 -0
- anystruct/images/img_stiffener.gif +0 -0
- anystruct/images/img_stress_button.gif +0 -0
- anystruct/images/img_title.gif +0 -0
- anystruct/images/img_transverse_stress.gif +0 -0
- anystruct/load_factor_window.py +166 -0
- anystruct/load_window.py +721 -0
- anystruct/main_application.py +7918 -0
- anystruct/make_grid_numpy.py +506 -0
- anystruct/make_queue.py +52 -0
- anystruct/make_stack.py +52 -0
- anystruct/ml_files/CL_CSR-Tank_req_cl_predictor.pickle +0 -0
- anystruct/ml_files/CL_CSR-Tank_req_cl_scaler.pickle +0 -0
- anystruct/ml_files/CL_CSR_plate_cl,_CSR_web_cl,_CSR_web_flange_cl,_CSR_flange_cl_predictor.pickle +0 -0
- anystruct/ml_files/CL_CSR_plate_cl,_CSR_web_cl,_CSR_web_flange_cl,_CSR_flange_cl_scaler.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_110_predictor_In-plane_support_cl_1_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_110_predictor_In-plane_support_cl_1_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_110_predictor_In-plane_support_cl_2,_3_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_110_predictor_In-plane_support_cl_2,_3_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_110_scaler_In-plane_support_cl_1_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_110_scaler_In-plane_support_cl_1_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_110_scaler_In-plane_support_cl_2,_3_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_110_scaler_In-plane_support_cl_2,_3_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_115_predictor_In-plane_support_cl_1_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_115_predictor_In-plane_support_cl_1_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_115_predictor_In-plane_support_cl_2,_3_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_115_predictor_In-plane_support_cl_2,_3_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_115_scaler_In-plane_support_cl_1_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_115_scaler_In-plane_support_cl_1_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_115_scaler_In-plane_support_cl_2,_3_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_buc_115_scaler_In-plane_support_cl_2,_3_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_110_predictor_In-plane_support_cl_1_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_110_predictor_In-plane_support_cl_1_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_110_predictor_In-plane_support_cl_2,_3_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_110_predictor_In-plane_support_cl_2,_3_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_110_scaler_In-plane_support_cl_1_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_110_scaler_In-plane_support_cl_1_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_110_scaler_In-plane_support_cl_2,_3_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_110_scaler_In-plane_support_cl_2,_3_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_115_predictor_In-plane_support_cl_1_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_115_predictor_In-plane_support_cl_1_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_115_predictor_In-plane_support_cl_2,_3_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_115_predictor_In-plane_support_cl_2,_3_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_115_scaler_In-plane_support_cl_1_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_115_scaler_In-plane_support_cl_1_UP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_115_scaler_In-plane_support_cl_2,_3_SP.pickle +0 -0
- anystruct/ml_files/CL_output_cl_str_ult_115_scaler_In-plane_support_cl_2,_3_UP.pickle +0 -0
- anystruct/opt_problem.py +31 -0
- anystruct/optimize.py +1680 -0
- anystruct/optimize_cylinder.py +898 -0
- anystruct/optimize_geometry.py +1708 -0
- anystruct/optimize_multiple_window.py +1507 -0
- anystruct/optimize_window.py +1117 -0
- anystruct/pl_stf_window.py +572 -0
- anystruct/report_generator.py +912 -0
- anystruct/sections.csv +202 -0
- anystruct/sesam_interface.py +115 -0
- anystruct/ship_section_example.txt +1 -0
- anystruct/stresses_window.py +269 -0
- anystruct/testCalc.py +118 -0
- anystructure-5.2.0.dist-info/METADATA +86 -0
- anystructure-5.2.0.dist-info/RECORD +99 -0
- anystructure-5.2.0.dist-info/WHEEL +5 -0
- anystructure-5.2.0.dist-info/entry_points.txt +2 -0
- anystructure-5.2.0.dist-info/licenses/LICENSE +21 -0
- anystructure-5.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
import pathlib
|
|
2
|
+
import tkinter as tk
|
|
3
|
+
from _tkinter import TclError
|
|
4
|
+
from tkinter.ttk import Combobox
|
|
5
|
+
import os
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
import anystruct.example_data as test
|
|
9
|
+
import anystruct.helper as hlp
|
|
10
|
+
except ModuleNotFoundError:
|
|
11
|
+
import ANYstructure.anystruct.example_data as test
|
|
12
|
+
import ANYstructure.anystruct.helper as hlp
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from matplotlib.backends.backend_tkagg import (
|
|
16
|
+
FigureCanvasTkAgg, NavigationToolbar2Tk)
|
|
17
|
+
# Implement the default Matplotlib key bindings.
|
|
18
|
+
from matplotlib.backend_bases import key_press_handler
|
|
19
|
+
from matplotlib.figure import Figure
|
|
20
|
+
|
|
21
|
+
class CreateStructureWindow():
|
|
22
|
+
'''
|
|
23
|
+
This is the tkinter GUI for defining plate/stiffener properties.
|
|
24
|
+
'''
|
|
25
|
+
def __init__(self, master, app):
|
|
26
|
+
super(CreateStructureWindow, self).__init__()
|
|
27
|
+
self._frame = master
|
|
28
|
+
self._frame.wm_title("Define structure properties")
|
|
29
|
+
self._frame.geometry('1800x900')
|
|
30
|
+
self._frame.grab_set()
|
|
31
|
+
self._root_dir = os.path.dirname(os.path.abspath(__file__))
|
|
32
|
+
if __name__ == '__main__':
|
|
33
|
+
self._initial_structure_obj = test.get_structure_calc_object()
|
|
34
|
+
self._initial_calc_obj = test.get_structure_calc_object()
|
|
35
|
+
|
|
36
|
+
self._section_list = []
|
|
37
|
+
self._section_objects = []
|
|
38
|
+
for section in hlp.helper_read_section_file('bulb_anglebar_tbar_flatbar.csv'):
|
|
39
|
+
SecObj = Section(section)
|
|
40
|
+
self._section_list = hlp.add_new_section(self._section_list, SecObj)
|
|
41
|
+
self._section_objects.append(SecObj)
|
|
42
|
+
# m = self._ent_section_list.children['menu']
|
|
43
|
+
# m.add_command(label=SecObj.__str__(), command=self.section_choose)
|
|
44
|
+
|
|
45
|
+
self._clicked_button = ["long stf", "ring stf", "ring frame", "flat long stf", 'flat stf', 'flat girder'][0]
|
|
46
|
+
else:
|
|
47
|
+
self.app = app
|
|
48
|
+
self._clicked_button = app._clicked_section_create# if app._line_is_active else None
|
|
49
|
+
try:
|
|
50
|
+
if self._clicked_button in ['flat stf', "flat long stf"]:
|
|
51
|
+
self._initial_structure_obj = self.app._line_to_struc[app._active_line][0].Stiffener
|
|
52
|
+
elif self._clicked_button == 'flat girder':
|
|
53
|
+
self._initial_structure_obj = self.app._line_to_struc[app._active_line][5].Girder
|
|
54
|
+
elif self._clicked_button in ["long stf"]:
|
|
55
|
+
self._initial_structure_obj = self.app._line_to_struc[app._active_line][5].LongStfObj
|
|
56
|
+
elif self._clicked_button == "ring stf":
|
|
57
|
+
self._initial_structure_obj = self.app._line_to_struc[app._active_line][5].RingStfObj
|
|
58
|
+
elif self._clicked_button == "ring frame":
|
|
59
|
+
self._initial_structure_obj = self.app._line_to_struc[app._active_line][0].RingFrameObj
|
|
60
|
+
else:
|
|
61
|
+
self._initial_structure_obj = None
|
|
62
|
+
|
|
63
|
+
except (KeyError, AttributeError) as error:
|
|
64
|
+
self._initial_structure_obj = None
|
|
65
|
+
self._section_list = [section.__str__() for section in app._sections]
|
|
66
|
+
self._section_objects = app._sections
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
image_dir = os.path.dirname(__file__) + '\\images\\'
|
|
70
|
+
self._opt_runned = False
|
|
71
|
+
self._opt_resutls = ()
|
|
72
|
+
self._draw_scale = 0.5
|
|
73
|
+
self._canvas_dim = (500, 450)
|
|
74
|
+
ent_w = 10
|
|
75
|
+
start_x, start_y, dx, dy = 20, 70, 60, 33
|
|
76
|
+
self._canvas_struc = tk.Canvas(self._frame, width=self._canvas_dim[0], height=self._canvas_dim[1],
|
|
77
|
+
background='azure', relief='groove', borderwidth=2)
|
|
78
|
+
self.structure_types = ['T','L', 'L-bulb','FB']
|
|
79
|
+
self._canvas_struc.place(x=10, y=440)
|
|
80
|
+
tk.Label(self._frame, text='-- Define structure properties here --', font='Verdana 15 bold').place(x=10, y=10)
|
|
81
|
+
#
|
|
82
|
+
# ### Adding matplotlib
|
|
83
|
+
# fig, ax = run_section_properties()# Figure(figsize=(4, 4), dpi=100)
|
|
84
|
+
# t = np.arange(0, 3, .01)
|
|
85
|
+
# #fig.add_subplot(111).plot(t, 2 * np.sin(2 * np.pi * t))
|
|
86
|
+
#
|
|
87
|
+
# canvas = FigureCanvasTkAgg(fig, master=master) # A tk.DrawingArea.
|
|
88
|
+
# canvas.draw()
|
|
89
|
+
# canvas.get_tk_widget().place(x=start_x+17*dx, y=start_y+dy )
|
|
90
|
+
#
|
|
91
|
+
# toolbar = NavigationToolbar2Tk(canvas, master)
|
|
92
|
+
# toolbar.update()
|
|
93
|
+
# canvas.get_tk_widget().place(x=start_x+17*dx, y=start_y+10*dy )
|
|
94
|
+
#
|
|
95
|
+
# def on_key_press(event):
|
|
96
|
+
# print("you pressed {}".format(event.key))
|
|
97
|
+
# key_press_handler(event, canvas, toolbar)
|
|
98
|
+
#
|
|
99
|
+
# canvas.mpl_connect("key_press_event", on_key_press)
|
|
100
|
+
|
|
101
|
+
self._new_spacing = tk.DoubleVar()
|
|
102
|
+
self._new_pl_thk = tk.DoubleVar()
|
|
103
|
+
self._new_web_h = tk.DoubleVar()
|
|
104
|
+
self._new_web_thk = tk.DoubleVar()
|
|
105
|
+
self._new_fl_w = tk.DoubleVar()
|
|
106
|
+
self._new_fl_thk = tk.DoubleVar()
|
|
107
|
+
self._new_stiffener_type = tk.StringVar()
|
|
108
|
+
self._new_stiffener_filter = tk.StringVar()
|
|
109
|
+
self._new_stiffener_filter.set('No filter applied')
|
|
110
|
+
self._new_girder_length = tk.DoubleVar()
|
|
111
|
+
self._new_section = tk.StringVar()
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
self._ent_section_list = Combobox(self._frame, values = self._section_list, textvariable = self._new_section,
|
|
115
|
+
width = 40)
|
|
116
|
+
self._ent_section_list.bind("<<ComboboxSelected>>", self.section_choose)
|
|
117
|
+
# self._ent_section_list = tk.OptionMenu(self._frame, self._new_section, command=self.section_choose,
|
|
118
|
+
# *['',] if self._section_list == [] else self._section_list)
|
|
119
|
+
self._ent_structure_options = tk.OptionMenu(self._frame,self._new_stiffener_type,
|
|
120
|
+
command=self.option_choose,*self.structure_types)
|
|
121
|
+
self._ent_filter_stf = tk.OptionMenu(self._frame,self._new_stiffener_filter,
|
|
122
|
+
command=self.regen_option_menu,*['No filter applied','L-bulb', 'L', 'FB', 'T'])
|
|
123
|
+
|
|
124
|
+
self._ent_spacing = tk.Entry(self._frame, textvariable=self._new_spacing, width=ent_w)
|
|
125
|
+
self._ent_pl_thk = tk.Entry(self._frame, textvariable=self._new_pl_thk, width=ent_w)
|
|
126
|
+
self._ent_web_h = tk.Entry(self._frame, textvariable=self._new_web_h, width=ent_w)
|
|
127
|
+
self._ent_web_thk = tk.Entry(self._frame, textvariable=self._new_web_thk, width=ent_w)
|
|
128
|
+
self._ent_fl_w = tk.Entry(self._frame, textvariable=self._new_fl_w, width=ent_w)
|
|
129
|
+
self._ent_fl_thk = tk.Entry(self._frame, textvariable=self._new_fl_thk, width=ent_w)
|
|
130
|
+
self._ent_girder_length = tk.Entry(self._frame, textvariable=self._new_girder_length, width=ent_w)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
tk.Label(self._frame, text='Stiffener type:', font='Verdana 9 bold').place(x=start_x, y=start_y )
|
|
135
|
+
tk.Label(self._frame, text='Girder length (Lg)', font='Verdana 9 bold').place(x=start_x+9*dx,
|
|
136
|
+
y=start_y + 15 * dy)
|
|
137
|
+
tk.Label(self._frame, text='[m]', font='Verdana 9 bold').place(x=start_x + 14 * dx,y=start_y + 15 * dy)
|
|
138
|
+
self._ent_girder_length.place(x=start_x + 12 * dx, y=start_y + 15 * dy)
|
|
139
|
+
|
|
140
|
+
tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x+3*dx, y=start_y+dy )
|
|
141
|
+
tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x+3*dx, y=start_y + 2*dy)
|
|
142
|
+
tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x +3*dx, y=start_y + 3*dy)
|
|
143
|
+
tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x+3*dx, y=start_y + 4*dy)
|
|
144
|
+
tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x+3*dx, y=start_y + 5*dy)
|
|
145
|
+
tk.Label(self._frame, text='[mm]', font='Verdana 9 bold').place(x=start_x+3*dx, y=start_y + 6*dy)
|
|
146
|
+
|
|
147
|
+
tk.Label(self._frame, text='Existing sections:', font='Verdana 9 bold').place(x=start_x+4*dx, y=start_y + 6*dy)
|
|
148
|
+
tk.Label(self._frame, text='filter ->', font='Verdana 9 bold').place(x=start_x + 4 * dx,
|
|
149
|
+
y=start_y + 7 * dy)
|
|
150
|
+
|
|
151
|
+
self._ent_section_list.place(x=start_x+7*dx, y=start_y + 6*dy)
|
|
152
|
+
self._ent_filter_stf.place(x=start_x+5*dx, y=start_y + 7*dy)
|
|
153
|
+
|
|
154
|
+
tk.Button(self._frame, text='Read section list from file', command=self.read_sections, font='Verdana 10 bold',
|
|
155
|
+
bg = 'blue', fg = 'yellow').place(x=start_x+12*dx, y=start_y + 6*dy)
|
|
156
|
+
tk.Button(self._frame, text='Load built in sections', command=self.read_sections_built_in, font='Verdana 10 bold',
|
|
157
|
+
bg = 'azure', fg = 'black').place(x=start_x+12*dx, y=start_y + 7*dy)
|
|
158
|
+
# setting default values
|
|
159
|
+
init_dim,init_thk = 0.05,0.002
|
|
160
|
+
|
|
161
|
+
if self._initial_structure_obj != None:
|
|
162
|
+
self._new_stiffener_type.set(self._initial_structure_obj.get_stiffener_type())
|
|
163
|
+
self._new_spacing.set(self._initial_structure_obj.get_s()*1000)
|
|
164
|
+
self._new_pl_thk.set(self._initial_structure_obj.get_pl_thk()*1000)
|
|
165
|
+
self._new_web_h.set(self._initial_structure_obj.get_web_h()*1000)
|
|
166
|
+
self._new_web_thk.set(self._initial_structure_obj.get_web_thk()*1000)
|
|
167
|
+
self._new_fl_w.set(self._initial_structure_obj.get_fl_w()*1000)
|
|
168
|
+
self._new_fl_thk.set(self._initial_structure_obj.get_fl_thk()*1000)
|
|
169
|
+
else:
|
|
170
|
+
self._new_spacing.set(0)
|
|
171
|
+
self._new_pl_thk.set(0)
|
|
172
|
+
self._new_web_h.set(0)
|
|
173
|
+
self._new_web_thk.set(0)
|
|
174
|
+
self._new_fl_w.set(0)
|
|
175
|
+
self._new_fl_thk.set(0)
|
|
176
|
+
|
|
177
|
+
self._new_girder_length.set(10)
|
|
178
|
+
|
|
179
|
+
self._ent_structure_options.place(x=start_x + dx * 3, y=start_y)
|
|
180
|
+
|
|
181
|
+
if self._new_spacing.get() != 0:
|
|
182
|
+
tk.Label(self._frame, text='Spacing', font='Verdana 9').place(x=start_x, y=start_y + dy)
|
|
183
|
+
self._ent_spacing.place(x=start_x + dx * 2, y=start_y+dy)
|
|
184
|
+
if self._new_pl_thk.get() != 0:
|
|
185
|
+
tk.Label(self._frame, text='Plate thk.', font='Verdana 9').place(x=start_x, y=start_y + 2 * dy)
|
|
186
|
+
self._ent_pl_thk.place(x=start_x + dx * 2, y=start_y+2*dy)
|
|
187
|
+
if self._new_web_h.get() != 0:
|
|
188
|
+
tk.Label(self._frame, text='Web height', font='Verdana 9').place(x=start_x, y=start_y + 3 * dy)
|
|
189
|
+
self._ent_web_h.place(x=start_x + dx * 2, y=start_y+3*dy)
|
|
190
|
+
if self._new_web_thk.get() != 0:
|
|
191
|
+
tk.Label(self._frame, text='Web thk.', font='Verdana 9').place(x=start_x, y=start_y + 4 * dy)
|
|
192
|
+
self._ent_web_thk.place(x=start_x + dx * 2, y=start_y+4*dy)
|
|
193
|
+
if self._new_fl_w.get() != 0:
|
|
194
|
+
tk.Label(self._frame, text='Flange width', font='Verdana 9').place(x=start_x, y=start_y + 5 * dy)
|
|
195
|
+
self._ent_fl_w.place(x=start_x + dx * 2, y=start_y+5*dy)
|
|
196
|
+
if self._new_fl_thk.get() != 0:
|
|
197
|
+
tk.Label(self._frame, text='Flange thk.', font='Verdana 9').place(x=start_x, y=start_y + 6 * dy)
|
|
198
|
+
self._ent_fl_thk.place(x=start_x + dx * 2, y=start_y+6*dy)
|
|
199
|
+
|
|
200
|
+
self._new_spacing.trace('w',self.draw_trace)
|
|
201
|
+
self._new_pl_thk.trace('w',self.draw_trace)
|
|
202
|
+
self._new_web_h.trace('w',self.draw_trace)
|
|
203
|
+
self._new_web_thk.trace('w',self.draw_trace)
|
|
204
|
+
self._new_fl_w.trace('w',self.draw_trace)
|
|
205
|
+
self._new_fl_thk.trace('w',self.draw_trace)
|
|
206
|
+
try:
|
|
207
|
+
img_file_name = 'img_stiffened_plate_panel.gif'
|
|
208
|
+
if os.path.isfile('images/' + img_file_name):
|
|
209
|
+
file_path = 'images/' + img_file_name
|
|
210
|
+
else:
|
|
211
|
+
file_path = os.path.dirname(os.path.abspath(__file__)) + '/images/' + img_file_name
|
|
212
|
+
photo = tk.PhotoImage(file=file_path)
|
|
213
|
+
label = tk.Label(self._frame, image=photo)
|
|
214
|
+
label.image = photo # keep a reference!
|
|
215
|
+
label.place(x=550, y=610)
|
|
216
|
+
except TclError:
|
|
217
|
+
pass
|
|
218
|
+
try:
|
|
219
|
+
img_file_name = 'img_T_L_FB.gif'
|
|
220
|
+
if os.path.isfile('images/' + img_file_name):
|
|
221
|
+
file_path = 'images/' + img_file_name
|
|
222
|
+
else:
|
|
223
|
+
file_path = os.path.dirname(os.path.abspath(__file__)) + '/images/' + img_file_name
|
|
224
|
+
photo_T_L_FB = tk.PhotoImage(file=file_path)
|
|
225
|
+
label = tk.Label(self._frame, image=photo_T_L_FB )
|
|
226
|
+
label.image = photo_T_L_FB # keep a reference!
|
|
227
|
+
label.place(x=270, y=50)
|
|
228
|
+
except TclError:
|
|
229
|
+
pass
|
|
230
|
+
|
|
231
|
+
# Close and save depending on input
|
|
232
|
+
# "long stf", "ring stf", "ring frame", "flat long stf"
|
|
233
|
+
if self._clicked_button is not None:
|
|
234
|
+
self.close_and_save = tk.Button(self._frame, text='Click to return section data to ' + self._clicked_button,
|
|
235
|
+
command=self.save_and_close, bg='green',
|
|
236
|
+
font='Verdana 10 bold', fg='yellow')
|
|
237
|
+
self.close_and_save.place(x=start_x + dx * 9, y=start_y + dy * 12)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
self.draw_properties()
|
|
242
|
+
|
|
243
|
+
def regen_option_menu(self, event = None):
|
|
244
|
+
self._ent_section_list.destroy()
|
|
245
|
+
sections = []
|
|
246
|
+
if self._section_list == []:
|
|
247
|
+
sections = ['',]
|
|
248
|
+
elif self._new_stiffener_filter.get() == 'No filter applied':
|
|
249
|
+
sections = self._section_list
|
|
250
|
+
else:
|
|
251
|
+
for sec_obj in self._section_objects:
|
|
252
|
+
if sec_obj.stf_type == self._new_stiffener_filter.get():
|
|
253
|
+
sections.append(sec_obj.__str__())
|
|
254
|
+
start_x, start_y, dx, dy = 20, 70, 60, 33
|
|
255
|
+
# self._ent_section_list = tk.OptionMenu(self._frame, self._new_section, command=self.section_choose,
|
|
256
|
+
# *sections)
|
|
257
|
+
self._ent_section_list = Combobox(self._frame, values=sections, textvariable=self._new_section, width = 40)
|
|
258
|
+
self._ent_section_list.bind("<<ComboboxSelected>>", self.section_choose)
|
|
259
|
+
self._ent_section_list.place(x=start_x + 7 * dx, y=start_y + 6 * dy)
|
|
260
|
+
|
|
261
|
+
pass
|
|
262
|
+
|
|
263
|
+
def option_choose(self, event):
|
|
264
|
+
'''
|
|
265
|
+
Action when the option menu is changed.
|
|
266
|
+
:param event:
|
|
267
|
+
:return:
|
|
268
|
+
'''
|
|
269
|
+
start_x, start_y, dx, dy = 20, 70, 50, 33
|
|
270
|
+
|
|
271
|
+
tk.Label(self._frame, text='Spacing', font='Verdana 9').place(x=start_x, y=start_y + dy)
|
|
272
|
+
self._ent_spacing.place(x=start_x + dx * 2, y=start_y+dy)
|
|
273
|
+
|
|
274
|
+
tk.Label(self._frame, text='Plate thk.', font='Verdana 9').place(x=start_x, y=start_y + 2 * dy)
|
|
275
|
+
self._ent_pl_thk.place(x=start_x + dx * 2, y=start_y+2*dy)
|
|
276
|
+
|
|
277
|
+
tk.Label(self._frame, text='Web height', font='Verdana 9').place(x=start_x, y=start_y + 3 * dy)
|
|
278
|
+
self._ent_web_h.place(x=start_x + dx * 2, y=start_y+3*dy)
|
|
279
|
+
|
|
280
|
+
tk.Label(self._frame, text='Web thk.', font='Verdana 9').place(x=start_x, y=start_y + 4 * dy)
|
|
281
|
+
self._ent_web_thk.place(x=start_x + dx * 2, y=start_y+4*dy)
|
|
282
|
+
|
|
283
|
+
if self._new_stiffener_type.get()!='FB':
|
|
284
|
+
tk.Label(self._frame, text='Flange width', font='Verdana 9').place(x=start_x, y=start_y + 5 * dy)
|
|
285
|
+
self._ent_fl_w.place(x=start_x + dx * 2, y=start_y+5*dy)
|
|
286
|
+
else: self._ent_fl_w.place_forget()
|
|
287
|
+
if self._new_stiffener_type.get()!='FB':
|
|
288
|
+
tk.Label(self._frame, text='Flange thk.', font='Verdana 9').place(x=start_x, y=start_y + 6 * dy)
|
|
289
|
+
self._ent_fl_thk.place(x=start_x + dx * 2, y=start_y+6*dy)
|
|
290
|
+
else: self._ent_fl_thk.place_forget()
|
|
291
|
+
if self._new_stiffener_type.get()=='FB':
|
|
292
|
+
self._new_fl_w.set(0)
|
|
293
|
+
self._new_fl_thk.set(0)
|
|
294
|
+
self.draw_properties()
|
|
295
|
+
|
|
296
|
+
def checkered(self, line_distance):
|
|
297
|
+
'''
|
|
298
|
+
Grid lines in the properties canvas.
|
|
299
|
+
:param line_distance:
|
|
300
|
+
:return:
|
|
301
|
+
'''
|
|
302
|
+
# vertical lines at an interval of "line_distance" pixel
|
|
303
|
+
for x in range(line_distance, self._canvas_dim[0], line_distance):
|
|
304
|
+
self._canvas_struc.create_line(x, 0, x, self._canvas_dim[0], fill="grey", stipple='gray50')
|
|
305
|
+
# horizontal lines at an interval of "line_distance" pixel
|
|
306
|
+
for y in range(line_distance, self._canvas_dim[1], line_distance):
|
|
307
|
+
self._canvas_struc.create_line(0, y, self._canvas_dim[0], y, fill="grey", stipple='gray50')
|
|
308
|
+
|
|
309
|
+
def draw_properties(self):
|
|
310
|
+
'''
|
|
311
|
+
Drawing properties in the canvas.
|
|
312
|
+
:return:
|
|
313
|
+
'''
|
|
314
|
+
self._canvas_struc.delete('all')
|
|
315
|
+
self.checkered(10)
|
|
316
|
+
ctr_x = self._canvas_dim[0] / 2
|
|
317
|
+
ctr_y = self._canvas_dim[1] / 2 + 200
|
|
318
|
+
m = self._draw_scale
|
|
319
|
+
init_color, init_stipple = 'blue', 'gray50'
|
|
320
|
+
|
|
321
|
+
try: spacing = self._new_spacing.get()
|
|
322
|
+
except TclError: spacing = 0
|
|
323
|
+
try: pl_thk = self._new_pl_thk.get()
|
|
324
|
+
except TclError: pl_thk = 0
|
|
325
|
+
try: web_h = self._new_web_h.get()
|
|
326
|
+
except TclError: web_h = 0
|
|
327
|
+
try: web_thk = self._new_web_thk.get()
|
|
328
|
+
except TclError: web_thk = 0
|
|
329
|
+
try: fl_w = self._new_fl_w.get()
|
|
330
|
+
except TclError: fl_w = 0
|
|
331
|
+
try: fl_thk = self._new_fl_thk.get()
|
|
332
|
+
except TclError: fl_thk = 0
|
|
333
|
+
|
|
334
|
+
self._canvas_struc.create_rectangle(0, 0, self._canvas_dim[0] + 10, 70, fill='white')
|
|
335
|
+
|
|
336
|
+
self._canvas_struc.create_text(250, 15, text='Plate: ' + str(spacing ) + 'x' +
|
|
337
|
+
str(pl_thk ),font='Verdana 10 bold',fill='black')
|
|
338
|
+
self._canvas_struc.create_rectangle(ctr_x - m * spacing / 2, ctr_y,ctr_x + m * spacing / 2,
|
|
339
|
+
ctr_y - m * pl_thk, fill='black', stipple=init_stipple)
|
|
340
|
+
|
|
341
|
+
self._canvas_struc.create_text(250, 35, text='Web: ' + str(web_h ) + 'x'+ str(web_thk )
|
|
342
|
+
,font='Verdana 10 bold',fill='blue')
|
|
343
|
+
self._canvas_struc.create_rectangle(ctr_x - m * web_thk / 2,ctr_y - m * pl_thk,ctr_x + m * web_thk / 2,
|
|
344
|
+
ctr_y - m * (web_h+ pl_thk), fill='blue', stipple=init_stipple)
|
|
345
|
+
|
|
346
|
+
self._canvas_struc.create_text(250, 55, text='Flange: '+ str(fl_w ) + 'x'+ str(fl_thk ),
|
|
347
|
+
font='Verdana 10 bold',fill='red')
|
|
348
|
+
if self._new_stiffener_type.get() in ['L', 'L-bulb']:
|
|
349
|
+
self._canvas_struc.create_rectangle(ctr_x - m * web_thk / 2, ctr_y- m * (pl_thk + web_h),ctr_x + m * fl_w,
|
|
350
|
+
ctr_y - m * (pl_thk + web_h + fl_thk),fill='red', stipple=init_stipple)
|
|
351
|
+
else:
|
|
352
|
+
self._canvas_struc.create_rectangle(ctr_x - m * fl_w / 2, ctr_y- m * (pl_thk + web_h),ctr_x + m * fl_w / 2,
|
|
353
|
+
ctr_y - m * (pl_thk + web_h + fl_thk),fill='red', stipple=init_stipple)
|
|
354
|
+
|
|
355
|
+
def draw_trace(self,*args):
|
|
356
|
+
'''
|
|
357
|
+
Updating when values in entered
|
|
358
|
+
:param event:
|
|
359
|
+
:return:
|
|
360
|
+
'''
|
|
361
|
+
self.draw_properties()
|
|
362
|
+
|
|
363
|
+
def save_and_close(self):
|
|
364
|
+
'''
|
|
365
|
+
Save and close
|
|
366
|
+
:return:
|
|
367
|
+
'''
|
|
368
|
+
if __name__ == '__main__':
|
|
369
|
+
self._frame.destroy()
|
|
370
|
+
return
|
|
371
|
+
|
|
372
|
+
self.app.on_close_structure_window([float(num) for num in [self._new_spacing.get(),self._new_pl_thk.get(),
|
|
373
|
+
self._new_web_h.get(),self._new_web_thk.get(),
|
|
374
|
+
self._new_fl_w.get(),self._new_fl_thk.get()]] +
|
|
375
|
+
[self._new_stiffener_type.get(), self._clicked_button])
|
|
376
|
+
self._frame.destroy()
|
|
377
|
+
|
|
378
|
+
def section_choose(self, event = None):
|
|
379
|
+
''' Choosing a section. '''
|
|
380
|
+
#chosen_section = self._new_section.get()
|
|
381
|
+
chosen_section = event.widget.get()
|
|
382
|
+
for section in self._section_objects:
|
|
383
|
+
if chosen_section == section.__str__():
|
|
384
|
+
self._new_web_h.set(section.stf_web_height*1000)
|
|
385
|
+
self._new_web_thk.set(section.stf_web_thk*1000)
|
|
386
|
+
self._new_fl_w.set(section.stf_flange_width*1000)
|
|
387
|
+
self._new_fl_thk.set(section.stf_flange_thk*1000)
|
|
388
|
+
self._new_stiffener_type.set(section.stf_type)
|
|
389
|
+
self.option_choose(None)
|
|
390
|
+
|
|
391
|
+
def read_sections(self):
|
|
392
|
+
'''
|
|
393
|
+
Read a list.
|
|
394
|
+
'''
|
|
395
|
+
from tkinter import filedialog
|
|
396
|
+
import anystruct.helper as hlp
|
|
397
|
+
from pathlib import Path
|
|
398
|
+
|
|
399
|
+
file = filedialog.askopenfile('r')
|
|
400
|
+
file = Path(file.name)
|
|
401
|
+
#m = self._ent_section_list.children['menu']
|
|
402
|
+
|
|
403
|
+
for section in hlp.helper_read_section_file(file.name):
|
|
404
|
+
SecObj = Section(section)
|
|
405
|
+
self._section_list = hlp.add_new_section(self._section_list, SecObj)
|
|
406
|
+
self._section_objects.append(SecObj)
|
|
407
|
+
#m.add_command(label=SecObj.__str__(), command=self.section_choose)
|
|
408
|
+
|
|
409
|
+
def read_sections_built_in(self):
|
|
410
|
+
'''
|
|
411
|
+
Read a list.
|
|
412
|
+
'''
|
|
413
|
+
import anystruct.helper as hlp
|
|
414
|
+
if pathlib.Path('bulb_anglebar_tbar_flatbar.csv').exists():
|
|
415
|
+
libfile = 'bulb_anglebar_tbar_flatbar.csv'
|
|
416
|
+
else:
|
|
417
|
+
libfile = 'bulb_anglebar_tbar_flatbar.csv'
|
|
418
|
+
libfile = self._root_dir + '/' + libfile
|
|
419
|
+
for section in hlp.helper_read_section_file(libfile):
|
|
420
|
+
SecObj = Section(section)
|
|
421
|
+
self._section_list = hlp.add_new_section(self._section_list, SecObj)
|
|
422
|
+
self._section_objects.append(SecObj)
|
|
423
|
+
#m.add_command(label=SecObj.__str__(), command=self.section_choose)
|
|
424
|
+
|
|
425
|
+
self.regen_option_menu()
|
|
426
|
+
|
|
427
|
+
class Section:
|
|
428
|
+
'''
|
|
429
|
+
Creates a section property.
|
|
430
|
+
'stf_type': [self._new_stf_type.get(), ''],
|
|
431
|
+
'stf_web_height': [self._new_stf_web_h.get()/1000, 'm'],
|
|
432
|
+
'stf_web_thk': [self._new_sft_web_t.get()/1000, 'm'],
|
|
433
|
+
'stf_flange_width': [self._new_stf_fl_w.get()/1000, 'm'],
|
|
434
|
+
'stf_flange_thk': [self._new_stf_fl_t.get()/1000, 'm'],
|
|
435
|
+
'''
|
|
436
|
+
def __init__(self, input_dict):
|
|
437
|
+
super(Section, self).__init__()
|
|
438
|
+
self._stf_type = input_dict['stf_type'] if type(input_dict['stf_type']) != list \
|
|
439
|
+
else input_dict['stf_type'][0]
|
|
440
|
+
self._stf_web_height = input_dict['stf_web_height']if type(input_dict['stf_web_height']) != list \
|
|
441
|
+
else input_dict['stf_web_height'][0]
|
|
442
|
+
self._stf_web_thk = input_dict['stf_web_thk']if type(input_dict['stf_web_thk']) != list \
|
|
443
|
+
else input_dict['stf_web_thk'][0]
|
|
444
|
+
self._stf_flange_width = input_dict['stf_flange_width']if type(input_dict['stf_flange_width']) != list \
|
|
445
|
+
else input_dict['stf_flange_width'][0]
|
|
446
|
+
self._stf_flange_thk = input_dict['stf_flange_thk']if type(input_dict['stf_flange_thk']) != list \
|
|
447
|
+
else input_dict['stf_flange_thk'][0]
|
|
448
|
+
|
|
449
|
+
def __str__(self):
|
|
450
|
+
''' Returning a string. '''
|
|
451
|
+
base_name = self.stf_type+ '_' + str(round(self.stf_web_height*1000, 0)) + 'x' + \
|
|
452
|
+
str(round(self.stf_web_thk*1000, 0))
|
|
453
|
+
if self._stf_type == 'FB':
|
|
454
|
+
ret_str = base_name
|
|
455
|
+
elif self._stf_type in ['L-bulb', 'bulb', 'hp']:
|
|
456
|
+
ret_str = 'Bulb'+str(int(self.stf_web_height*1000 + self.stf_flange_thk*1000))+'x'+\
|
|
457
|
+
str(round(self.stf_web_thk*1000, 0))+ '__' +str(round(self.stf_web_height*1000, 0)) + 'x' + \
|
|
458
|
+
str(round(self.stf_web_thk*1000, 0))+ str(round(self.stf_flange_width*1000, 0)) + 'x' + \
|
|
459
|
+
str(round(self.stf_flange_thk*1000, 0))
|
|
460
|
+
else:
|
|
461
|
+
ret_str = base_name + '__' + str(round(self.stf_flange_width*1000, 0)) + 'x' + \
|
|
462
|
+
str(round(self.stf_flange_thk*1000, 0))
|
|
463
|
+
|
|
464
|
+
ret_str = ret_str.replace('.', '_')
|
|
465
|
+
|
|
466
|
+
return ret_str
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
@property
|
|
470
|
+
def stf_type(self):
|
|
471
|
+
return self._stf_type
|
|
472
|
+
|
|
473
|
+
@stf_type.setter
|
|
474
|
+
def stf_type(self, value):
|
|
475
|
+
self._stf_type = value
|
|
476
|
+
|
|
477
|
+
@property
|
|
478
|
+
def stf_web_height(self):
|
|
479
|
+
return self._stf_web_height
|
|
480
|
+
|
|
481
|
+
@stf_web_height.setter
|
|
482
|
+
def stf_web_height(self, value):
|
|
483
|
+
self._stf_web_height = value
|
|
484
|
+
|
|
485
|
+
@property
|
|
486
|
+
def stf_web_thk(self):
|
|
487
|
+
return self._stf_web_thk
|
|
488
|
+
|
|
489
|
+
@stf_web_thk.setter
|
|
490
|
+
def stf_web_thk(self, value):
|
|
491
|
+
self._stf_web_thk = value
|
|
492
|
+
|
|
493
|
+
@property
|
|
494
|
+
def stf_flange_width(self):
|
|
495
|
+
return self._stf_flange_width
|
|
496
|
+
|
|
497
|
+
@stf_flange_width.setter
|
|
498
|
+
def stf_flange_width(self, value):
|
|
499
|
+
self._stf_flange_width = value
|
|
500
|
+
|
|
501
|
+
@property
|
|
502
|
+
def stf_flange_thk(self):
|
|
503
|
+
return self._stf_flange_thk
|
|
504
|
+
|
|
505
|
+
@stf_flange_thk.setter
|
|
506
|
+
def stf_flange_thk(self, value):
|
|
507
|
+
self._stf_flange_thk = value
|
|
508
|
+
|
|
509
|
+
def return_puls_input(self):
|
|
510
|
+
'''
|
|
511
|
+
Returns as input good for PULS
|
|
512
|
+
:return:
|
|
513
|
+
'''
|
|
514
|
+
return {'Stiffener type (L,T,F)': self.stf_type, 'Stiffener boundary': 'C',
|
|
515
|
+
'Stiff. Height': self.stf_web_height*1000,
|
|
516
|
+
'Web thick.': self.stf_web_thk*1000, 'Flange width': self.stf_flange_width*1000,
|
|
517
|
+
'Flange thick.': self.stf_flange_thk*1000}
|
|
518
|
+
|
|
519
|
+
# def run_section_properties(pl_s = 0.75, pl_t = 0.015, hw = 0.4, tw = 0.018, bf = 0.15, tf = 0.02):
|
|
520
|
+
# import sectionproperties.pre.sections as sections
|
|
521
|
+
# from sectionproperties.analysis.cross_section import CrossSection
|
|
522
|
+
# from matplotlib import pyplot as plt
|
|
523
|
+
#
|
|
524
|
+
# # create a 50 diameter circle discretised by 64 points
|
|
525
|
+
# geometry = sections.MonoISection(
|
|
526
|
+
# d=(pl_t+hw+tf)*1000, b_t=bf*1000, b_b=pl_s*1000, t_ft=tf*1000, t_fb=pl_t*1000, t_w=tw*1000, r=8, n_r=16
|
|
527
|
+
# )
|
|
528
|
+
# mesh = geometry.create_mesh(mesh_sizes=[3.0])
|
|
529
|
+
# section = CrossSection(geometry, mesh) # create a CrossSection object
|
|
530
|
+
# mesh_nodes = section.mesh_nodes
|
|
531
|
+
# mesh_elements = section.mesh_elements
|
|
532
|
+
# # plot the mesh
|
|
533
|
+
# (fig, ax) = plt.subplots(figsize=(4, 4), dpi=100)
|
|
534
|
+
# ax.triplot(mesh_nodes[:, 0], mesh_nodes[:, 1], mesh_elements[:, 0:3], lw=0.5)
|
|
535
|
+
# # #section.display_mesh_info() # display the mesh information
|
|
536
|
+
# # ax = section.plot_mesh(pause=True) # plot the generated mesh
|
|
537
|
+
# #
|
|
538
|
+
# # # perform a geometric, warping and plastic analysis, displaying the time info
|
|
539
|
+
# # section.calculate_geometric_properties(time_info=True)
|
|
540
|
+
# # section.calculate_warping_properties(time_info=True)
|
|
541
|
+
# # section.calculate_plastic_properties(time_info=True)
|
|
542
|
+
# #
|
|
543
|
+
# # # print the results to the terminal
|
|
544
|
+
# # section.display_results()
|
|
545
|
+
# #
|
|
546
|
+
# # # get the second moments of area and the torsion constant
|
|
547
|
+
# # (ixx_c, iyy_c, ixy_c) = section.get_ic()
|
|
548
|
+
# # j = section.get_j()
|
|
549
|
+
# #
|
|
550
|
+
# # # print the sum of the second moments of area and the torsion constant
|
|
551
|
+
# # print("Ixx + Iyy = {0:.3f}".format(ixx_c + iyy_c))
|
|
552
|
+
# # print("J = {0:.3f}".format(j))
|
|
553
|
+
# return fig, ax
|
|
554
|
+
#
|
|
555
|
+
#
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
if __name__ == '__main__':
|
|
560
|
+
|
|
561
|
+
# sec1 = Section({'stf_type': 'T', 'stf_web_height': 0.35, 'stf_web_thk': 0.02, 'stf_flange_width': 0.15,
|
|
562
|
+
# 'stf_flange_thk': 0.015})
|
|
563
|
+
#
|
|
564
|
+
# sec_list = [sec1, Section({'stf_type': 'FB', 'stf_web_height': 0.35, 'stf_web_thk': 0.02, 'stf_flange_width': 0,
|
|
565
|
+
# 'stf_flange_thk': 0}), Section({'stf_type': 'T', 'stf_web_height': 0.4, 'stf_web_thk': 0.02,
|
|
566
|
+
# 'stf_flange_width': 0.15, 'stf_flange_thk': 0.02})]
|
|
567
|
+
#
|
|
568
|
+
# hlp.add_new_section(sec_list, sec1)
|
|
569
|
+
# run_section_properties()
|
|
570
|
+
root = tk.Tk()
|
|
571
|
+
my_app = CreateStructureWindow(root, app=None)
|
|
572
|
+
root.mainloop()
|