Exemplo n.º 1
0
    def __init__(self, master, app=None):
        super(CreateStressesWindow, self).__init__()
        if __name__ == '__main__':
            self._initial_structure_obj = test.get_structure_object()
            self.default_stresses = test.get_default_stresses()
            image_dir = os.path.dirname(__file__) + '\\images\\'
        else:
            self.app = app
            try:
                self._initial_structure_obj = app._line_to_struc[app._active_line][0]
            except KeyError:
                self._initial_structure_obj = None
            self.default_stresses = app._default_stresses
            image_dir = app._root_dir + '\\images\\'

        self._frame = master
        self._frame.wm_title("Specify strucutre - returned to input field in main window")
        self._frame.geometry('1500x810')
        self._frame.grab_set()

        self._opt_runned = False
        self._opt_resutls = ()

        self._draw_scale = 500
        self._canvas_dim = (500, 450)

        tk.Label(self._frame, text='-- Global stresses and fixation parameter in plate/stiffener --',
                 font='Verdana 15 bold').place(x=10, y=10)

        ent_w = 10
        # stresses in plate and stiffener

        self._new_structure_type = tk.StringVar()
        self._new_trans_stress_high = tk.DoubleVar()
        self._new_trans_stress_low = tk.DoubleVar()
        self._new_axial_stress = tk.DoubleVar()
        self._new_shear_stress = tk.DoubleVar()
        self._new_km1 = tk.DoubleVar()
        self._new_km2 = tk.DoubleVar()
        self._new_km3 = tk.DoubleVar()
        self._new_kpp = tk.DoubleVar()
        self._new_kps = tk.DoubleVar()
        self._new_max_pressure_side = tk.StringVar()

        self._ent_structure_type = tk.OptionMenu(self._frame,self._new_structure_type,command=self.change_option_menu,
                                                *self.default_stresses.keys())
        self._ent_trans_stress_high = tk.Entry(self._frame, textvariable=self._new_trans_stress_high, width=ent_w)
        self._ent_trans_stress_low = tk.Entry(self._frame, textvariable=self._new_trans_stress_low, width=ent_w)
        self._ent_axial_stress = tk.Entry(self._frame, textvariable=self._new_axial_stress, width=ent_w)
        self._ent_shear_stress = tk.Entry(self._frame, textvariable=self._new_shear_stress, width=ent_w)
        self._ent_km1 = tk.Entry(self._frame, textvariable=self._new_km1, width=ent_w)
        self._ent_km2 = tk.Entry(self._frame, textvariable=self._new_km2, width=ent_w)
        self._ent_km3 = tk.Entry(self._frame, textvariable=self._new_km3, width=ent_w)
        self._ent_kpp = tk.Entry(self._frame, textvariable=self._new_kpp, width=ent_w)
        self._ent_kps = tk.Entry(self._frame, textvariable=self._new_kps, width=ent_w)
        self._ent_pressure_side = tk.OptionMenu(self._frame,self._new_max_pressure_side,*('p','s'))

        start_x,start_y,dx,dy = 20,100,100,35

        ###
        # tk.Label(self._frame, text='Input stresses and parameters:', font='Verdana 12 bold',fg='red') \
        #     .place(x=start_x , y=start_y + 9 * dy)

        tk.Label(self._frame, text='Select strucutre type:', font='Verdana 9',fg='red') \
            .place(x=start_x , y=start_y + 10 * dy)

        tk.Label(self._frame, text='Sigma,y1_Sd - large transversal stress', font='Verdana 9') \
            .place(x=start_x , y=start_y + 11 * dy)
        tk.Label(self._frame, text='[MPa]', font='Verdana 9 bold') \
            .place(x=start_x + dx * 4, y=start_y + 11 * dy)

        tk.Label(self._frame, text='Sigma,y2_Sd - small transversal stress', font='Verdana 9') \
            .place(x=start_x, y=start_y + 12* dy)
        tk.Label(self._frame, text='[MPa]', font='Verdana 9 bold') \
            .place(x=start_x + dx * 4, y=start_y + 12 * dy)

        tk.Label(self._frame, text='Sigma,x_Sd - axial stress', font='Verdana 9') \
            .place(x=start_x, y=start_y + 13 * dy)
        tk.Label(self._frame, text='[MPa]', font='Verdana 9 bold') \
            .place(x=start_x + dx * 4, y=start_y + 13 * dy)

        tk.Label(self._frame, text='Tau,xy - shear stress', font='Verdana 9') \
            .place(x=start_x, y=start_y + 14 * dy)
        tk.Label(self._frame, text='[MPa]', font='Verdana 9 bold') \
            .place(x=start_x + dx * 4, y=start_y + 14 * dy)

        tk.Label(self._frame, text='km1, bending moment factor', font='Verdana 9') \
            .place(x=start_x, y=start_y + 15 * dy)

        tk.Label(self._frame, text='km2, bending moment factor', font='Verdana 9') \
            .place(x=start_x, y=start_y + 16 * dy)

        tk.Label(self._frame, text='km3, bending moment factor', font='Verdana 9') \
            .place(x=start_x, y=start_y + 17 * dy)

        tk.Label(self._frame, text='kpp, fixation parameter plate', font='Verdana 9') \
            .place(x=start_x, y=start_y + 18 * dy)

        tk.Label(self._frame, text='kps, fixation parameter stiffener', font='Verdana 9') \
            .place(x=start_x, y=start_y + 19 * dy)

        tk.Label(self._frame, text='Max pressure side (plate of stiffener)', font='Verdana 9 bold') \
            .place(x=start_x+5*dx, y=start_y + 8 * dy)

        self._ent_structure_type.place(x=start_x + dx * 3, y=start_y + 10 * dy)
        self._ent_trans_stress_high.place(x=start_x + dx * 3, y=start_y + 11 * dy)
        self._ent_trans_stress_low.place(x=start_x + dx * 3, y=start_y + 12 * dy)
        self._ent_axial_stress.place(x=start_x + dx * 3, y=start_y + 13 * dy)
        self._ent_shear_stress.place(x=start_x + dx * 3, y=start_y + 14 * dy)
        self._ent_km1.place(x=start_x + dx * 3, y=start_y + 15 * dy)
        self._ent_km2.place(x=start_x + dx * 3, y=start_y + 16 * dy)
        self._ent_km3.place(x=start_x + dx * 3, y=start_y + 17 * dy)
        self._ent_kpp.place(x=start_x + dx * 3, y=start_y + 18 * dy)
        self._ent_kps.place(x=start_x + dx * 3, y=start_y + 19 * dy)
        self._ent_pressure_side.place(x=start_x+8*dx, y=start_y + 8 * dy)

        # setting default values
        init_dim = 0.05
        init_thk = 0.002

        if self._initial_structure_obj != None:
            self._new_trans_stress_high.set(self._initial_structure_obj.get_sigma_y1())
            self._new_trans_stress_low.set(self._initial_structure_obj.get_sigma_y2())
            self._new_axial_stress.set(self._initial_structure_obj.get_sigma_y2())
            self._new_shear_stress.set(self._initial_structure_obj.get_tau_xy())
            self._new_km1.set(self._initial_structure_obj.get_km1())
            self._new_km2.set(self._initial_structure_obj.get_km2())
            self._new_km3.set(self._initial_structure_obj.get_km3())
            self._new_kpp.set(self._initial_structure_obj.get_kpp())
            self._new_kps.set(self._initial_structure_obj.get_kps())
            self._new_structure_type.set(self._initial_structure_obj.get_structure_type())

        else:
            self._new_structure_type.set('GENERAL_INTERNAL_WT')
            self._new_trans_stress_high.set(self.default_stresses[self._new_structure_type.get()][0])
            self._new_trans_stress_low.set(self.default_stresses[self._new_structure_type.get()][1])
            self._new_axial_stress.set(self.default_stresses[self._new_structure_type.get()][2])
            self._new_shear_stress.set(self.default_stresses[self._new_structure_type.get()][3])
            self._new_km1.set(12)
            self._new_km2.set(24)
            self._new_km3.set(12)
            self._new_kpp.set(1)
            self._new_kps.set(1)
            self._new_max_pressure_side.set('p')
        try:
            img_file_name = 'img_transverse_stress.gif'
            if os.path.isfile('images/' + img_file_name):
                file_path ='images/' + img_file_name
            else:
                file_path = app._root_dir + '/images/' + img_file_name
            photo_transverse = tk.PhotoImage(file=file_path)
            label_trans = tk.Label(self._frame, image=photo_transverse)
            label_trans.image = photo_transverse  # keep a reference!
            label_trans.place(x=start_x, y=60)
        except TclError:
            pass

        try:
            img_file_name = "img_axial_stresses.gif"
            if os.path.isfile('images/' + img_file_name):
                file_path ='images/' + img_file_name
            else:
                file_path = app._root_dir + '/images/' + img_file_name
            photo_axial = tk.PhotoImage(file=file_path)
            label_axial = tk.Label(self._frame, image=photo_axial)
            label_axial.image = photo_axial  # keep a reference!
            label_axial.place(x=start_x+5*dx, y=60)
        except TclError:
            pass

        try:
            img_file_name = 'img_fixation_parameters.gif'
            if os.path.isfile('images/' + img_file_name):
                file_path ='images/' + img_file_name
            else:
                file_path = app._root_dir + '/images/' + img_file_name
            photo = tk.PhotoImage(file=file_path)
            label_fix = tk.Label(self._frame, image=photo)
            label_fix.image = photo  # keep a reference!
            label_fix.place(x=start_x+9.5*dx, y=60)
        except TclError:
            pass

        tk.Label(self._frame,text='The stresses are global values and is estimated '
                                 '\nby user.\n'
                                 'Alterntively read out stresses from FE-model.\n'
                                 'Suggestions for input:\n'
                                 'Transverse stresses (Sigma,y_Sd is calculated):\n'
                                 '   - conservative - about 100 MPa \n'
                                 '   - non-conservative - about 60 MPa\n'
                                 'Axial stresses: \n'
                                 '   - about 60 MPa\n'
                                 '   - non-conservative - about 40 MPa\n'
                                 'Shear stresses: \n'
                                 '   - about 20 MPa\n'
                                 '   - non-conservative - about 1 MPa', justify=tk.LEFT,
                 font = 'Verdana 10', fg = 'blue',bg='white')\
            .place(x=start_x+dx*4.5,y=start_y+dy*11)

        self._close_and_save = tk.Button(self._frame, text='Return and set stresses and fixation parameter',
                                        command=self.save_and_close, bg='green', font='Verdana 10', fg='yellow')
        self._close_and_save.place(x=start_x + dx * 4.5, y=start_y + dy * 19)
Exemplo n.º 2
0
    def __init__(self, master, app=None):
        super(CreateFatigueWindow, self).__init__()
        if __name__ == '__main__':
            self._initial_structure_obj = test.get_structure_object()
            self.load_objects = [
                test.get_loa_fls_load(),
                test.get_loa_uls_load(),
                test.get_bal_fls_load(),
                test.get_bal_uls_load()
            ]
            self.active_line = 'line1'
            points = test.line_dict['line1']
            coords = (test.point_dict['point' + str(points[0])],
                      test.point_dict['point' + str(points[1])])
            self.pressure_coords = self.get_pressure_point_coord_from_two_points(
                coords[0], coords[1])
            self.comp_objects = [test.get_tank_object()]
            self._initial_fatigue_obj = test.get_fatigue_object()

        else:
            self.app = app
            self.active_line = app._active_line
            points = app._line_dict[self.active_line]
            coords = (app._point_dict['point' + str(points[0])],
                      app._point_dict['point' + str(points[1])])
            self.pressure_coords = self.get_pressure_point_coord_from_two_points(
                coords[0], coords[1])
            self._initial_structure_obj = app._line_to_struc[
                app._active_line][0]
            self.load_objects = app._line_to_struc[app._active_line][3]
            self.comp_objects = [
                app._tank_dict['comp' + str(comp_i)]
                for comp_i in app.get_compartments_for_line(app._active_line)
            ]
            self._initial_fatigue_obj = app._line_to_struc[self.active_line][2]

        self._frame = master
        self._frame.wm_title("Specify fatigue properties here.")
        self._frame.geometry('1300x810')
        self._frame.grab_set()

        tk.Label(
            self._frame,
            text='-- Fatigue calculation for plates according to DNVGL-RP-C203, '
            'Section 5 Simplified fatigue analysis --',
            font='Verdana 15 bold').place(x=10, y=10)

        ent_w = 10

        self.new_sn_curve = tk.StringVar()
        self.new_k_factor = tk.DoubleVar()
        self.new_no_of_cycles = tk.DoubleVar()
        self.new_design_life = tk.DoubleVar()
        self.new_dff = tk.DoubleVar()

        self.new_weibull_loa = tk.DoubleVar()
        self.new_weibull_bal = tk.DoubleVar()
        self.new_weibull_prt = tk.DoubleVar()

        self.new_period_loa = tk.DoubleVar()
        self.new_period_bal = tk.DoubleVar()
        self.new_period_prt = tk.DoubleVar()

        self.new_corr_loc_loa = tk.DoubleVar()
        self.new_corr_loc_bal = tk.DoubleVar()
        self.new_corr_loc_prt = tk.DoubleVar()

        self.new_fraction_loa = tk.DoubleVar()
        self.new_fraction_bal = tk.DoubleVar()
        self.new_fraction_prt = tk.DoubleVar()

        self.new_az_loa = tk.DoubleVar()
        self.new_az_bal = tk.DoubleVar()
        self.new_az_prt = tk.DoubleVar()

        sn_curves = sn.get_all_curves()

        self.ent_sn_curve = tk.OptionMenu(self._frame,
                                          self.new_sn_curve,
                                          command=self.change_sn_curve,
                                          *sn_curves)
        self.ent_dff = tk.Entry(self._frame,
                                textvariable=self.new_dff,
                                width=ent_w)
        self.ent_k_factor = tk.Entry(self._frame,
                                     textvariable=self.new_k_factor,
                                     width=ent_w)
        self.ent_no_of_cycles = tk.Entry(self._frame,
                                         textvariable=self.new_no_of_cycles,
                                         width=ent_w)
        self.ent_new_design_life = tk.Entry(self._frame,
                                            textvariable=self.new_design_life,
                                            width=ent_w)

        self.ent_weibull_loa = tk.Entry(self._frame,
                                        textvariable=self.new_weibull_loa,
                                        width=ent_w)
        self.ent_weibull_bal = tk.Entry(self._frame,
                                        textvariable=self.new_weibull_bal,
                                        width=ent_w)
        self.ent_weibull_prt = tk.Entry(self._frame,
                                        textvariable=self.new_weibull_prt,
                                        width=ent_w)

        self.ent_period_loa = tk.Entry(self._frame,
                                       textvariable=self.new_period_loa,
                                       width=ent_w)
        self.ent_period_bal = tk.Entry(self._frame,
                                       textvariable=self.new_period_bal,
                                       width=ent_w)
        self.ent_period_prt = tk.Entry(self._frame,
                                       textvariable=self.new_period_prt,
                                       width=ent_w)

        self.ent_corr_loc_loa = tk.Entry(self._frame,
                                         textvariable=self.new_corr_loc_loa,
                                         width=ent_w)
        self.ent_corr_loc_bal = tk.Entry(self._frame,
                                         textvariable=self.new_corr_loc_bal,
                                         width=ent_w)
        self.ent_corr_loc_prt = tk.Entry(self._frame,
                                         textvariable=self.new_corr_loc_prt,
                                         width=ent_w)

        self.ent_fraction_loa = tk.Entry(self._frame,
                                         textvariable=self.new_fraction_loa,
                                         width=ent_w)
        self.ent_fraction_bal = tk.Entry(self._frame,
                                         textvariable=self.new_fraction_bal,
                                         width=ent_w)
        self.ent_fraction_prt = tk.Entry(self._frame,
                                         textvariable=self.new_fraction_prt,
                                         width=ent_w)

        self.ent_acc_loa = tk.Entry(self._frame,
                                    textvariable=self.new_az_loa,
                                    width=ent_w)
        self.ent_acc_bal = tk.Entry(self._frame,
                                    textvariable=self.new_az_bal,
                                    width=ent_w)
        self.ent_acc_prt = tk.Entry(self._frame,
                                    textvariable=self.new_az_prt,
                                    width=ent_w)

        start_x, start_y, dx, dy = 20, 100, 150, 35

        loaded_exist = False
        ballast_exist = False
        part_exist = False
        fls_exist = (loaded_exist, ballast_exist, part_exist)

        # Frames to hide loaded, ballast or part
        loa_fr = tk.Frame(self._frame,
                          width=100,
                          height=170,
                          bg="gray25",
                          colormap="new")
        bal_fr = tk.Frame(self._frame,
                          width=100,
                          height=170,
                          bg="gray25",
                          colormap="new")
        prt_fr = tk.Frame(self._frame,
                          width=100,
                          height=170,
                          bg="gray25",
                          colormap="new")

        for load in self.load_objects:
            if load != None:
                if load.get_limit_state() == 'FLS':
                    if load.get_load_condition() == 'loaded':
                        loaded_exist = True
                    elif load.get_load_condition() == 'ballast':
                        ballast_exist = True
                    elif load.get_load_condition() == 'part':
                        part_exist = True
                    else:
                        pass
            fls_exist = (loaded_exist, ballast_exist, part_exist)

        if self._initial_fatigue_obj == None:
            self.new_sn_curve.set('Ec')
            self.new_k_factor.set(1)
            self.new_no_of_cycles.set(10000)
            self.new_design_life.set(20)
            self.new_dff.set(2)
            if any(fls_exist):
                if loaded_exist:
                    self.new_fraction_loa.set(1 / fls_exist.count(True))
                    self.new_weibull_loa.set(0.8)
                    self.new_period_loa.set(8)
                    self.new_corr_loc_loa.set(0.5)
                    self.new_az_loa.set(0.5)
                if ballast_exist:
                    self.new_fraction_bal.set(1 / fls_exist.count(True))
                    self.new_weibull_bal.set(0.8)
                    self.new_period_bal.set(8)
                    self.new_corr_loc_bal.set(0.5)
                    self.new_az_bal.set(0.5)
                if part_exist:
                    self.new_fraction_prt.set(1 / fls_exist.count(True))
                    self.new_weibull_prt.set(0.8)
                    self.new_period_prt.set(8)
                    self.new_corr_loc_prt.set(0.5)
                    self.new_az_prt.set(0.5)
        else:
            fat_prop = self._initial_fatigue_obj.get_fatigue_properties()
            self.new_sn_curve.set(fat_prop['SN-curve'])
            self.new_k_factor.set(fat_prop['SCF'])
            self.new_no_of_cycles.set(fat_prop['n0'])
            self.new_design_life.set(fat_prop['Design life'])
            self.new_dff.set(fat_prop['DFF'])
            if any(fls_exist):
                if loaded_exist:
                    self.new_fraction_loa.set(fat_prop['Fraction'][0])
                    self.new_weibull_loa.set(fat_prop['Weibull'][0])
                    self.new_period_loa.set(fat_prop['Period'][0])
                    self.new_corr_loc_loa.set(fat_prop['CorrLoc'][0])
                    self.new_az_loa.set(fat_prop['Accelerations'][0])
                if ballast_exist:
                    self.new_fraction_bal.set(fat_prop['Fraction'][1])
                    self.new_weibull_bal.set(fat_prop['Weibull'][1])
                    self.new_period_bal.set(fat_prop['Period'][1])
                    self.new_corr_loc_bal.set(fat_prop['CorrLoc'][1])
                    self.new_az_bal.set(fat_prop['Accelerations'][1])
                if part_exist:
                    self.new_fraction_prt.set(fat_prop['Fraction'][2])
                    self.new_weibull_prt.set(fat_prop['Weibull'][2])
                    self.new_period_prt.set(fat_prop['Period'][2])
                    self.new_corr_loc_prt.set(fat_prop['CorrLoc'][2])
                    self.new_az_prt.set(fat_prop['Accelerations'][2])

        all_acc = (self.new_az_loa.get(), self.new_az_bal.get(),
                   self.new_az_prt.get())

        count = 1
        for load in self.load_objects:
            press = []
            if load.get_limit_state() == 'FLS':
                tk.Label(self._frame, text=str(count)+'. '+load.get_name(), font='Verdana 8')\
                    .place(x=start_x + 5 * dx, y=start_y + (5+count) * dy)
                idx = 0
                for exist in fls_exist:
                    if exist:
                        press.append(
                            round(
                                load.get_calculated_pressure(
                                    self.pressure_coords, all_acc[idx],
                                    self._initial_structure_obj.
                                    get_structure_type()), 1))
                        idx += 1

                tk.Label(self._frame, text=press, font='Verdana 8') \
                    .place(x=start_x + 6.5 * dx, y=start_y + (5 + count) * dy)
                count += 1
        press = []
        for comp in self.comp_objects:

            tk.Label(self._frame, text=str(count) + '. ' +str(comp.get_name()), font='Verdana 8') \
                .place(x=start_x + 5 * dx, y=start_y + (5 + count) * dy)

            idx = 0

            if fls_exist[0] and comp.is_loaded_condition():
                press.append(
                    round(
                        comp.get_calculated_pressure(self.pressure_coords,
                                                     all_acc[0]), 1))
            if fls_exist[1] and comp.is_ballast_condition():
                press.append(
                    round(
                        comp.get_calculated_pressure(self.pressure_coords,
                                                     all_acc[1]), 1))
            if fls_exist[2] and any(
                [comp.is_loaded_condition(),
                 comp.is_ballast_condition()]):
                press.append(
                    round(
                        comp.get_calculated_pressure(self.pressure_coords,
                                                     all_acc[2]), 1))

            tk.Label(self._frame, text=press, font='Verdana 8') \
                .place(x=start_x + 6.5 * dx, y=start_y + (5 + count) * dy)

            count += 1

        tk.Label(self._frame, text='Design life:', font='Verdana 8 bold') \
            .place(x=start_x , y=start_y + 0*dy)
        tk.Label(self._frame, text='Design Fatigue Factor (DFF):', font='Verdana 8 bold') \
            .place(x=start_x+ 3*dx , y=start_y + 0*dy)
        tk.Label(self._frame, text='SN-curve:', font='Verdana 8 bold') \
            .place(x=start_x , y=start_y + 1*dy)
        tk.Label(self._frame, text='Cycles in return period, n0', font='Verdana 8 bold') \
            .place(x=start_x , y=start_y + 2*dy)
        tk.Label(self._frame, text='Stress Concentration Factor, SCF', font='Verdana 8 bold') \
            .place(x=start_x , y=start_y + 3*dy)

        tk.Label(self._frame, text='Loaded', font='Verdana 8 bold') \
            .place(x=start_x+2*dx , y=start_y + 5*dy)
        tk.Label(self._frame, text='Ballast', font='Verdana 8 bold') \
            .place(x=start_x+3*dx , y=start_y + 5*dy)
        tk.Label(self._frame, text='Part', font='Verdana 8 bold') \
            .place(x=start_x+4*dx , y=start_y + 5*dy)
        tk.Label(self._frame, text='Defined loads', font='Verdana 8 bold') \
            .place(x=start_x+5*dx , y=start_y + 5*dy)
        tk.Label(self._frame, text='Resulting pressures', font='Verdana 8 bold') \
            .place(x=start_x+6.5*dx , y=start_y + 5*dy)

        tk.Label(self._frame, text='Fraction (sum of bal/part/loa is 1)', font='Verdana 8 bold') \
            .place(x=start_x, y=start_y + 6 * dy)
        tk.Label(self._frame, text='Weibull', font='Verdana 8 bold') \
            .place(x=start_x , y=start_y + 7*dy)
        tk.Label(self._frame, text='Period', font='Verdana 8 bold') \
            .place(x=start_x , y=start_y + 8*dy)
        tk.Label(self._frame, text='Corr. loc.', font='Verdana 8 bold') \
            .place(x=start_x , y=start_y + 9*dy)
        tk.Label(self._frame, text='Accelerations', font='Verdana 8 bold') \
            .place(x=start_x , y=start_y + 10*dy)

        self.ent_new_design_life.place(x=start_x + 2 * dx, y=start_y + 0 * dy)
        self.ent_dff.place(x=start_x + 5 * dx, y=start_y + 0 * dy)
        self.ent_sn_curve.place(x=start_x + 2 * dx, y=start_y + 1 * dy)
        self.ent_no_of_cycles.place(x=start_x + 2 * dx, y=start_y + 2 * dy)
        self.ent_k_factor.place(x=start_x + 2 * dx, y=start_y + 3 * dy)

        self.ent_fraction_loa.place(x=start_x + 2 * dx, y=start_y + 6 * dy)
        self.ent_fraction_bal.place(x=start_x + 3 * dx, y=start_y + 6 * dy)
        self.ent_fraction_prt.place(x=start_x + 4 * dx, y=start_y + 6 * dy)

        self.ent_weibull_loa.place(x=start_x + 2 * dx, y=start_y + 7 * dy)
        self.ent_weibull_bal.place(x=start_x + 3 * dx, y=start_y + 7 * dy)
        self.ent_weibull_prt.place(x=start_x + 4 * dx, y=start_y + 7 * dy)

        self.ent_period_loa.place(x=start_x + 2 * dx, y=start_y + 8 * dy)
        self.ent_period_bal.place(x=start_x + 3 * dx, y=start_y + 8 * dy)
        self.ent_period_prt.place(x=start_x + 4 * dx, y=start_y + 8 * dy)

        self.ent_corr_loc_loa.place(x=start_x + 2 * dx, y=start_y + 9 * dy)
        self.ent_corr_loc_bal.place(x=start_x + 3 * dx, y=start_y + 9 * dy)
        self.ent_corr_loc_prt.place(x=start_x + 4 * dx, y=start_y + 9 * dy)

        self.ent_acc_loa.place(x=start_x + 2 * dx, y=start_y + 10 * dy)
        self.ent_acc_bal.place(x=start_x + 3 * dx, y=start_y + 10 * dy)
        self.ent_acc_prt.place(x=start_x + 4 * dx, y=start_y + 10 * dy)

        # if not loaded_exist:
        #     loa_fr.place(x=start_x + 2 * dx, y=start_y + 6 * dy)
        # elif not ballast_exist:
        #     bal_fr.place(x=start_x + 3 * dx, y=start_y + 6 * dy)
        # elif not part_exist:
        #     prt_fr.place(x=start_x + 4 * dx, y=start_y + 6 * dy)

        self._close_and_save = tk.Button(self._frame,
                                         text='Return fatigue parameters',
                                         command=self.save_and_close,
                                         bg='green',
                                         font='Verdana 15',
                                         fg='yellow')
        self._close_and_save.place(x=start_x + dx, y=start_y + dy * 15)
Exemplo n.º 3
0
        else:
            to_return_final.append(value)
    if len(append_list) == 1:
        to_return_final = append_list[0]
    elif len(append_list) == 0:
        pass
    elif len(append_list) > 1:
        to_return_final = append_list

    return to_return_final


def open_example_file(root_path=None):
    import os

    if os.path.isfile('sections.csv'):
        os.startfile('sections.csv')
    else:
        os.startfile(root_path + '/' + 'sections.csv')


if __name__ == '__main__':
    import ANYstructure.example_data as ex
    file = ['bulb.xml', 'flatbar.xml', 'tbar.xml']
    all_returned = helper_read_section_file(file,
                                            obj=ex.get_structure_object(),
                                            to_csv=True)

    import random
    print(random.choice(all_returned))