def default_library_gases(self):
        try:

            from ctREFPROP.ctREFPROP import REFPROPFunctionLibrary

            self.list_gases = {}
            self.fluid_file_to_final_name = {}
            refProp_path = os.environ['RPPREFIX']

            if os.path.exists(refProp_path):

                self.RefProp = REFPROPFunctionLibrary(refProp_path)
                self.RefProp.SETPATHdll(refProp_path)
                refProp_fluids_path = get_new_path(refProp_path, "FLUIDS")
                list_files = os.listdir(refProp_fluids_path)

                for fluid_file in list_files:
                    if ".BNC" not in fluid_file:
                        filepath = get_new_path(refProp_fluids_path,
                                                fluid_file)

                        f = open(filepath, 'r')
                        line_0 = f.readline()
                        line_1 = f.readline()
                        line_2 = f.readline()

                        f.close()
                        short_name = line_0.split("!")[0]
                        full_name = line_2.split("!")[0]

                        letter = " "
                        while letter == " ":
                            short_name = short_name[:-1]
                            letter = short_name[-1]

                        letter = " "
                        while letter == " ":
                            full_name = full_name[:-1]
                            letter = full_name[-1]

                        final_name = short_name if short_name == full_name else f"{short_name} ({full_name})"
                        self.list_gases[final_name] = [
                            fluid_file, short_name, full_name
                        ]
                        self.fluid_file_to_final_name[fluid_file] = final_name
            else:
                title = "REFPROP installation not detected"
                message = "Dear user, REFPROP application files were not found in the computer's default paths. "
                message += "Please, install the REFPROP on your computer to enable the set-up of the fluids mixture."
                PrintMessageInput([title, message, "ERROR"])
                return True

        except Exception as log_error:
            title = "Error while loading REFPROP"
            message = "An error has been reached while trying to load REFPROP data. If the REFPROP module has already been "
            message += "installed we recommend running the 'pip install ctREFPROP' command at the terminal to install the "
            message += "necessary libraries."
            message += f"\n\n{str(log_error)}"
            PrintMessageInput([title, message, "ERROR"])
            return True
    def save_table_values(self, frequencies, complex_values, basename):

        header = " COMPRESSOR MODEL PARAMETERS\n\n"
        for key, value in self.parameters.items():
            header += "{} = {}\n".format(key, str(value))

        header += "\nACOUSTIC COMPRESSOR EXCITATION: VOLUME VELOCITY SOURCE"
        header += "\n\nFrequency [Hz], real[m³/s], imaginary[m³/s], absolute[m³/s]"

        f_min = frequencies[0]
        f_max = frequencies[-1]
        f_step = frequencies[1] - frequencies[0]

        if self.project.change_project_frequency_setup("Compressor excitation",
                                                       list(frequencies)):
            return True
        else:
            self.project.set_frequencies(frequencies, f_min, f_max, f_step)

        self.project.create_folders_acoustic("compressor_excitation_files")
        self.new_load_path_table = get_new_path(
            self.compressor_excitation_tables_folder_path, basename)

        real_values = np.real(complex_values)
        imag_values = np.imag(complex_values)
        abs_values = np.abs(complex_values)
        data = np.array([frequencies, real_values, imag_values, abs_values]).T
        np.savetxt(self.new_load_path_table,
                   data,
                   delimiter=",",
                   header=header)
        return False
示例#3
0
 def update(self):
     list_picked_nodes = self.opv.getListPickedPoints()
     if list_picked_nodes != []:
         picked_node = list_picked_nodes[0]
         node = self.preprocessor.nodes[picked_node]
         if node.volume_velocity is not None:
             self.reset_input_fields(force_reset=True)
             if node.compressor_excitation_table_names == []:
                 if node.volume_velocity_table_name is not None:
                     table_name = node.volume_velocity_table_name
                     self.tabWidget_volume_velocity.setCurrentWidget(
                         self.tab_table_values)
                     table_name = get_new_path(
                         self.volume_velocity_tables_folder_path,
                         table_name)
                     self.lineEdit_load_table_path.setText(table_name)
                 else:
                     volume_velocity = node.volume_velocity
                     self.tabWidget_volume_velocity.setCurrentWidget(
                         self.tab_constant_values)
                     self.lineEdit_volume_velocity_real.setText(
                         str(np.real(volume_velocity)))
                     self.lineEdit_volume_velocity_imag.setText(
                         str(np.imag(volume_velocity)))
                 self.inputs_from_node = True
         else:
             self.reset_input_fields()
         self.writeNodes(self.opv.getListPickedPoints())
示例#4
0
 def update(self):
     list_picked_nodes = self.opv.getListPickedPoints()
     if list_picked_nodes != []:
         picked_node = list_picked_nodes[0]
         node = self.preprocessor.nodes[picked_node]
         if node.acoustic_pressure is not None:
             self.reset_input_fields(force_reset=True)
             if node.acoustic_pressure_table_name is not None:
                 table_name = node.acoustic_pressure_table_name
                 self.tabWidget_acoustic_pressure.setCurrentWidget(
                     self.tab_table_values)
                 table_name = get_new_path(
                     self.acoustic_pressure_tables_folder_path, table_name)
                 self.lineEdit_load_table_path.setText(table_name)
             else:
                 acoustic_pressure = node.acoustic_pressure
                 self.tabWidget_acoustic_pressure.setCurrentWidget(
                     self.tab_constant_values)
                 self.lineEdit_acoustic_pressure_real.setText(
                     str(np.real(acoustic_pressure)))
                 self.lineEdit_acoustic_pressure_imag.setText(
                     str(np.imag(acoustic_pressure)))
             self.inputs_from_node = True
         else:
             self.reset_input_fields()
         self.writeNodes(self.opv.getListPickedPoints())
示例#5
0
    def save_tables_files(self, node_id, values, filename, load_label):

        real_values = np.real(values)
        imag_values = np.imag(values)
        abs_values = np.abs(values)
        data = np.array(
            [self.frequencies, real_values, imag_values, abs_values]).T
        self.project.create_folders_structural("nodal_loads_files")

        if load_label in ["Fx", "Fy", "Fz"]:
            header = f"OpenPulse - imported table for {load_label} nodal force @ node {node_id} \n"
            header += f"\nSource filename: {filename}\n"
            header += "\nFrequency [Hz], real[N], imaginary[N], absolute[N]"
        else:
            header = f"OpenPulse - imported table for {load_label} nodal moment @ node {node_id} \n"
            header += f"\nSource filename: {filename}\n"
            header += "\nFrequency [Hz], real[N.m], imaginary[N.m], absolute[N.m]"

        basename = f"nodal_load_{load_label}_node_{node_id}.dat"

        new_path_table = get_new_path(self.nodal_loads_files_folder_path,
                                      basename)
        np.savetxt(new_path_table, data, delimiter=",", header=header)

        return values, basename
示例#6
0
    def save_table_file(self, node_id, values, filename):
        try:

            self.project.create_folders_acoustic("acoustic_pressure_files")

            real_values = np.real(values)
            imag_values = np.imag(values)
            abs_values = np.abs(values)
            data = np.array(
                [self.frequencies, real_values, imag_values, abs_values]).T

            header = f"OpenPulse - imported table for acoustic pressure @ node {node_id}\n"
            header += f"\nSource filename: {filename}\n"
            header += "\nFrequency [Hz], real[Pa], imaginary[Pa], absolute[Pa]"
            basename = f"acoustic_pressure_node_{node_id}.dat"

            new_path_table = get_new_path(
                self.acoustic_pressure_tables_folder_path, basename)
            np.savetxt(new_path_table, data, delimiter=",", header=header)
            return values, basename

        except Exception as log_error:
            title = "Error reached while saving table files"
            message = str(log_error)
            PrintMessageInput([title, message, window_title_1])
            return None, None
示例#7
0
 def update(self):
     list_picked_nodes = self.opv.getListPickedPoints()
     if list_picked_nodes != []:
         picked_node = list_picked_nodes[0]
         node = self.preprocessor.nodes[picked_node]
         if node.there_are_prescribed_dofs:
             self.reset_input_fields(force_reset=True)
             if node.loaded_table_for_prescribed_dofs:
                 table_names = node.prescribed_dofs_table_names
                 self.tabWidget_prescribed_dofs.setCurrentWidget(self.tab_table_values)
                 for index, lineEdit_table in enumerate(self.list_lineEdit_table_values):
                     if table_names[index] is not None:
                         table_name = get_new_path(self.prescribed_dofs_files_folder_path, table_names[index])
                         lineEdit_table.setText(table_name)
             else:
                 prescribed_dofs = node.prescribed_dofs
                 self.tabWidget_prescribed_dofs.setCurrentWidget(self.tab_constant_values)
                 for index, [lineEdit_real, lineEdit_imag] in enumerate(self.list_lineEdit_constant_values):
                     if prescribed_dofs[index] is not None:
                         lineEdit_real.setText(str(np.real(prescribed_dofs[index])))
                         lineEdit_imag.setText(str(np.imag(prescribed_dofs[index])))
             self.inputs_from_node = True
         else:
             self.reset_input_fields()
         self.writeNodes(self.opv.getListPickedPoints())
 def update_all_file_paths(self):
     new_geometry_path = get_new_path(
         self.new_project_folder_path,
         os.path.basename(self.current_geometry_path))
     new_material_list_path = get_new_path(
         self.new_project_folder_path,
         os.path.basename(self.current_material_list_path))
     new_fluid_list_path = get_new_path(
         self.new_project_folder_path,
         os.path.basename(self.current_fluid_list_path))
     if self.import_type == 0:
         self.project.copy_project(self.new_project_folder_path,
                                   self.new_project_name,
                                   new_material_list_path,
                                   new_fluid_list_path,
                                   geometry_path=new_geometry_path)
     elif self.import_type == 1:
         pass
    def update_project_ini_name(self):
        project_ini_file_path = get_new_path(self.new_project_folder_path,
                                             self.project_ini)
        config = configparser.ConfigParser()
        config.read(project_ini_file_path)

        config['PROJECT']['Name'] = self.new_project_name

        with open(project_ini_file_path, 'w') as config_file:
            config.write(config_file)
 def remove_other_files(self):
     list_filenames = os.listdir(self.current_project_file_path).copy()
     for filename in list_filenames:
         if filename not in [
                 "entity.dat", "fluidList.dat", "materialList.dat",
                 "project.ini", self.geometry_filename
         ]:
             file_path = get_new_path(self.current_project_file_path,
                                      filename)
             if os.path.exists(file_path):
                 os.remove(file_path)
示例#11
0
 def update_project_attributes(self, undo_remesh=False):
     project_ini_file_path = get_new_path(self.project_file_path,
                                          self.project_ini)
     config = configparser.ConfigParser()
     config.read(project_ini_file_path)
     if undo_remesh:
         config['PROJECT']['element size'] = str(self.current_element_size)
     else:
         config['PROJECT']['element size'] = str(self.new_element_size)
     config['PROJECT']['Geometry tolerance'] = str(self.geometry_tolerance)
     with open(project_ini_file_path, 'w') as config_file:
         config.write(config_file)
示例#12
0
    def process_integration_and_save_table_files(self, node_id, values, filename, dof_label, linear=False, angular=False):
        if self.frequencies[0]==0:
            self.frequencies[0] = float(1e-6)
        if linear:    
            if self.linear_disp:
                values = values
                header = "OpenPulse - imported table for prescribed displacement {} @ node {} \n"
                header += f"\nSource filename: {filename}\n"
                header += "\nFrequency [Hz], real[m], imaginary[m], absolute[m]"
            elif self.linear_vel:
                values = values/(1j*2*pi*self.frequencies)
                header = "OpenPulse - imported table for prescribed velocity {} @ node {} \n"
                header += f"\nSource filename: {filename}\n"
                header += "\nFrequency [Hz], real[m/s], imaginary[m/s], absolute[m/s]"
            elif self.linear_acc:
                values = values/((1j*2*pi*self.frequencies)**2)
                header = "OpenPulse - imported table for prescribed acceleration {} @ node {} \n"
                header += f"\nSource filename: {filename}\n"
                header += "\nFrequency [Hz], real[m/s²], imaginary[m/s²], absolute[m/s²]"
        if angular:    
            if self.angular_disp:
                values = values
                header = "OpenPulse - imported table for prescribed angular displacement {} @ node {} \n"
                header += f"\nSource filename: {filename}\n"
                header += "\nFrequency [Hz], real[rad], imaginary[rad], absolute[rad]"
            elif self.angular_vel:
                values = values/(1j*2*pi*self.frequencies)
                header = "OpenPulse - imported table for prescribed angular velocity {} @ node {} \n"
                header += f"\nSource filename: {filename}\n"
                header += "\nFrequency [Hz], real[rad/s], imaginary[rad/s], absolute[rad/s]"
            elif self.angular_acc:              
                values = values/((1j*2*pi*self.frequencies)**2)
                header = "OpenPulse - imported table for prescribed angular acceleration {} @ node {} \n"
                header += f"\nSource filename: {filename}\n"
                header += "\nFrequency [Hz], real[rad/s²], imaginary[rad/s²], absolute[rad/s²]"
        
        if self.frequencies[0] == float(1e-6):
            self.frequencies[0] = 0
        
        real_values = np.real(values)
        imag_values = np.imag(values)
        abs_values = np.abs(values)
        data = np.array([self.frequencies, real_values, imag_values, abs_values]).T
        self.project.create_folders_structural("prescribed_dofs_files")
        
        basename = f"prescribed_dof_{dof_label}_node_{node_id}.dat"

        header = header.format(dof_label.capitalize(), node_id)
        new_path_table = get_new_path(self.prescribed_dofs_files_folder_path, basename)
        np.savetxt(new_path_table, data, delimiter=",", header=header)

        return values, basename
    def update_project_settings(self):
        project_ini_file_path = get_new_path(self.current_project_file_path,
                                             self.project_ini)
        config = configparser.ConfigParser()
        config.read(project_ini_file_path)

        config['PROJECT']['geometry file'] = self.geometry_filename
        config['PROJECT']['element size'] = str(self.new_element_size)
        config['PROJECT']['geometry tolerance'] = str(
            self.new_geometry_tolerance)

        with open(project_ini_file_path, 'w') as config_file:
            config.write(config_file)
 def copy_geometry_file_to_project_folder(self):
     self.new_geometry_path = get_new_path(self.current_project_file_path,
                                           self.geometry_filename)
     if not os.path.samefile(
             self.lineEdit_new_geometry_file_path.text(),
             self.lineEdit_current_geometry_file_path.text()):
         if not os.path.samefile(
                 os.path.dirname(
                     self.lineEdit_new_geometry_file_path.text()),
                 os.path.dirname(
                     self.lineEdit_current_geometry_file_path.text())):
             copyfile(self.selected_geometry_path, self.new_geometry_path)
             return False
     else:
         return True
 def export_animation_to_file(self):
     if self.lineEdit_FileName.text() != "":
         file_format = self.get_file_format()
         filename = self.lineEdit_FileName.text() + file_format
         if os.path.exists(self.save_path):
             self.export_file_path = get_new_path(self.save_path, filename)
             self.opv.opvAnalysisRenderer.start_export_animation_to_file(
                 self.export_file_path, self.frames)
             self.process_animation()
         else:
             title = "Invalid folder path"
             message = "Inform a valid folder path before trying export the animation.\n\n"
             message += f"{self.label_export_path.text()}"
             PrintMessageInput([title, message, "ERROR"])
             self.label_export_path.setText("<Folder path>")
     else:
         title = "Empty file name"
         message = "Inform a file name before trying export the animation."
         PrintMessageInput([title, message, "ERROR"])
         self.lineEdit_FileName.setFocus()
示例#16
0
    def createProjectFile(self):

        self.project_file_path = get_new_path(self.project_folder_path,
                                              self.projectFileName)

        config = configparser.ConfigParser()
        config['PROJECT'] = {}
        config['PROJECT']['Name'] = self.lineEdit_project_name.text()

        if self.currentTab == 0:
            geometry_file_name = os.path.basename(
                self.lineEdit_import_geometry.text())
            element_size = self.lineEdit_element_size.text()
            geometry_tolerance = self.lineEdit_geometry_tolerance.text()

            config['PROJECT']['Import type'] = str(0)
            config['PROJECT']['Geometry file'] = geometry_file_name
            config['PROJECT']['Element size'] = element_size
            config['PROJECT']['Geometry tolerance'] = geometry_tolerance

        elif self.currentTab == 1:
            nodal_coordinates_filename = os.path.basename(
                self.lineEdit_import_nodal_coordinates.text())
            connectivity_matrix_filename = os.path.basename(
                self.lineEdit_import_connectivity.text())
            config['PROJECT']['Import type'] = str(1)
            config['PROJECT'][
                'Nodal coordinates file'] = nodal_coordinates_filename
            config['PROJECT'][
                'Connectivity matrix file'] = connectivity_matrix_filename

        config['PROJECT']['Material list file'] = self.materialListName
        config['PROJECT']['Fluid list file'] = self.fluidListName

        with open(self.project_file_path, 'w') as config_file:
            config.write(config_file)
示例#17
0
 def createFluidFile(self):
     self.fluid_list_path = get_new_path(self.project_folder_path,
                                         self.fluidListName)
     default_fluid_library(self.fluid_list_path)
示例#18
0
 def createMaterialFile(self):
     self.material_list_path = get_new_path(self.project_folder_path,
                                            self.materialListName)
     default_material_library(self.material_list_path)
示例#19
0
    def createProject(self):

        self.project_folder_path = get_new_path(
            self.project_directory, self.lineEdit_project_name.text())

        if not os.path.exists(self.project_folder_path):
            os.makedirs(self.project_folder_path)

        self.createMaterialFile()
        self.createFluidFile()
        self.createProjectFile()

        if self.currentTab == 0:
            geometry_filename = os.path.basename(
                self.lineEdit_import_geometry.text())
            new_geometry_path = get_new_path(self.project_folder_path,
                                             geometry_filename)
            copyfile(self.lineEdit_import_geometry.text(), new_geometry_path)
            project_name = self.lineEdit_project_name.text()
            element_size = float(self.lineEdit_element_size.text())
            geometry_tolerance = float(self.lineEdit_geometry_tolerance.text())
            import_type = 0
            self.config.writeRecentProject(project_name,
                                           self.project_file_path)
            self.project.new_project(self.project_folder_path,
                                     project_name,
                                     element_size,
                                     geometry_tolerance,
                                     import_type,
                                     self.material_list_path,
                                     self.fluid_list_path,
                                     geometry_path=new_geometry_path)
            return True

        elif self.currentTab == 1:
            nodal_coordinates_filename = os.path.basename(
                self.lineEdit_import_nodal_coordinates.text())
            connectivity_filename = os.path.basename(
                self.lineEdit_import_connectivity.text())
            new_cord_path = get_new_path(self.project_folder_path,
                                         nodal_coordinates_filename)
            new_conn_path = get_new_path(self.project_folder_path,
                                         connectivity_filename)
            copyfile(self.lineEdit_import_nodal_coordinates.text(),
                     new_cord_path)
            copyfile(self.lineEdit_import_connectivity.text(), new_conn_path)
            project_name = self.lineEdit_project_name.text()
            element_size = 0
            import_type = 1
            self.config.writeRecentProject(project_name,
                                           self.project_file_path)
            self.project.new_project(self.project_folder_path,
                                     project_name,
                                     element_size,
                                     import_type,
                                     self.material_list_path,
                                     self.fluid_list_path,
                                     conn_path=new_conn_path,
                                     coord_path=new_cord_path)
            return True
        return False
示例#20
0
    def __init__(self, project, opv, *args, **kwargs):
        super(DOFInput, self).__init__(*args, **kwargs)
        uic.loadUi('data/user_input/ui/Model/Setup/Structural/dofInput.ui', self)

        icons_path = 'data\\icons\\'
        self.icon = QIcon(icons_path + 'pulse.png')
        self.setWindowIcon(self.icon)

        self.setWindowFlags(Qt.WindowStaysOnTopHint)
        self.setWindowModality(Qt.WindowModal)

        self.opv = opv
        self.opv.setInputObject(self)

        self.project = project
        self.preprocessor = project.preprocessor
        self.before_run = project.get_pre_solution_model_checks()

        self.userPath = os.path.expanduser('~')
        self.new_load_path_table = ""
        self.imported_filename = ""
        self.structural_bc_info_path = project.file._node_structural_path
        self.structural_folder_path = self.project.file._structural_imported_data_folder_path
        self.prescribed_dofs_files_folder_path = get_new_path(self.structural_folder_path, "prescribed_dofs_files")

        self.nodes = self.preprocessor.nodes
        self.prescribed_dofs = None
        self.nodes_typed = []
        self.inputs_from_node = False
        self.copy_path = False
        self.basenames = []
        self.list_Nones = [None, None, None, None, None, None]

        self.stop = False
        self.list_frequencies = []
        
        self.lineEdit_nodeID = self.findChild(QLineEdit, 'lineEdit_nodeID')

        self.lineEdit_real_ux = self.findChild(QLineEdit, 'lineEdit_real_ux')
        self.lineEdit_real_uy = self.findChild(QLineEdit, 'lineEdit_real_uy')
        self.lineEdit_real_uz = self.findChild(QLineEdit, 'lineEdit_real_uz')
        self.lineEdit_real_rx = self.findChild(QLineEdit, 'lineEdit_real_rx')
        self.lineEdit_real_ry = self.findChild(QLineEdit, 'lineEdit_real_ry')
        self.lineEdit_real_rz = self.findChild(QLineEdit, 'lineEdit_real_rz')
        self.lineEdit_real_alldofs = self.findChild(QLineEdit, 'lineEdit_real_alldofs')

        self.lineEdit_imag_ux = self.findChild(QLineEdit, 'lineEdit_imag_ux')
        self.lineEdit_imag_uy = self.findChild(QLineEdit, 'lineEdit_imag_uy')
        self.lineEdit_imag_uz = self.findChild(QLineEdit, 'lineEdit_imag_uz')
        self.lineEdit_imag_rx = self.findChild(QLineEdit, 'lineEdit_imag_rx')
        self.lineEdit_imag_ry = self.findChild(QLineEdit, 'lineEdit_imag_ry')
        self.lineEdit_imag_rz = self.findChild(QLineEdit, 'lineEdit_imag_rz')
        self.lineEdit_imag_alldofs = self.findChild(QLineEdit, 'lineEdit_imag_alldofs')

        self.list_lineEdit_constant_values = [  [self.lineEdit_real_ux, self.lineEdit_imag_ux],
                                                [self.lineEdit_real_uy, self.lineEdit_imag_uy],
                                                [self.lineEdit_real_uz, self.lineEdit_imag_uz],
                                                [self.lineEdit_real_rx, self.lineEdit_imag_rx],
                                                [self.lineEdit_real_ry, self.lineEdit_imag_ry],
                                                [self.lineEdit_real_rz, self.lineEdit_imag_rz]  ]

        self.lineEdit_path_table_ux = self.findChild(QLineEdit, 'lineEdit_path_table_ux')
        self.lineEdit_path_table_uy = self.findChild(QLineEdit, 'lineEdit_path_table_uy')
        self.lineEdit_path_table_uz = self.findChild(QLineEdit, 'lineEdit_path_table_uz')
        self.lineEdit_path_table_rx = self.findChild(QLineEdit, 'lineEdit_path_table_rx')
        self.lineEdit_path_table_ry = self.findChild(QLineEdit, 'lineEdit_path_table_ry')
        self.lineEdit_path_table_rz = self.findChild(QLineEdit, 'lineEdit_path_table_rz')

        self.list_lineEdit_table_values = [ self.lineEdit_path_table_ux,
                                            self.lineEdit_path_table_uy,
                                            self.lineEdit_path_table_uz,
                                            self.lineEdit_path_table_rx,
                                            self.lineEdit_path_table_ry,
                                            self.lineEdit_path_table_rz ]

        self.toolButton_load_ux_table = self.findChild(QToolButton, 'toolButton_load_ux_table')
        self.toolButton_load_uy_table = self.findChild(QToolButton, 'toolButton_load_uy_table')
        self.toolButton_load_uz_table = self.findChild(QToolButton, 'toolButton_load_uz_table')
        self.toolButton_load_rx_table = self.findChild(QToolButton, 'toolButton_load_rx_table')
        self.toolButton_load_ry_table = self.findChild(QToolButton, 'toolButton_load_ry_table')
        self.toolButton_load_rz_table = self.findChild(QToolButton, 'toolButton_load_rz_table') 

        self.toolButton_load_ux_table.clicked.connect(self.load_ux_table)
        self.toolButton_load_uy_table.clicked.connect(self.load_uy_table)
        self.toolButton_load_uz_table.clicked.connect(self.load_uz_table)
        self.toolButton_load_rx_table.clicked.connect(self.load_rx_table)
        self.toolButton_load_ry_table.clicked.connect(self.load_ry_table)
        self.toolButton_load_rz_table.clicked.connect(self.load_rz_table)

        self.ux_table = None
        self.uy_table = None
        self.uz_table = None
        self.rx_table = None
        self.ry_table = None
        self.rz_table = None

        self.ux_filename = None
        self.uy_filename = None
        self.uz_filename = None
        self.rx_filename = None
        self.ry_filename = None
        self.rz_filename = None

        self.ux_basename = None
        self.uy_basename = None
        self.uz_basename = None
        self.rx_basename = None
        self.ry_basename = None
        self.rz_basename = None

        self.radioButton_linear_disp = self.findChild(QRadioButton, 'radioButton_linear_disp')    
        self.radioButton_linear_vel = self.findChild(QRadioButton, 'radioButton_linear_vel')  
        self.radioButton_linear_acc = self.findChild(QRadioButton, 'radioButton_linear_acc')     
        self.radioButton_linear_disp.clicked.connect(self.radioButtonEvent_linear_data)
        self.radioButton_linear_vel.clicked.connect(self.radioButtonEvent_linear_data)   
        self.radioButton_linear_acc.clicked.connect(self.radioButtonEvent_linear_data) 
        self.linear_disp = self.radioButton_linear_disp.isChecked()
        self.linear_vel  = self.radioButton_linear_vel.isChecked()
        self.linear_acc  = self.radioButton_linear_acc.isChecked()
    
        self.radioButton_angular_disp = self.findChild(QRadioButton, 'radioButton_angular_disp')    
        self.radioButton_angular_vel = self.findChild(QRadioButton, 'radioButton_angular_vel')  
        self.radioButton_angular_acc = self.findChild(QRadioButton, 'radioButton_angular_acc')  
        self.radioButton_angular_disp.clicked.connect(self.radioButtonEvent_angular_data)
        self.radioButton_angular_vel.clicked.connect(self.radioButtonEvent_angular_data)   
        self.radioButton_angular_acc.clicked.connect(self.radioButtonEvent_angular_data)         
        self.angular_disp = self.radioButton_angular_disp.isChecked()
        self.angular_vel  = self.radioButton_angular_vel.isChecked()
        self.angular_acc  = self.radioButton_angular_acc.isChecked()

        self.tabWidget_prescribed_dofs = self.findChild(QTabWidget, "tabWidget_prescribed_dofs")
        self.tab_constant_values = self.tabWidget_prescribed_dofs.findChild(QWidget, "tab_constant_values")
        self.tab_table_values = self.tabWidget_prescribed_dofs.findChild(QWidget, "tab_table_values")

        self.treeWidget_prescribed_dofs = self.findChild(QTreeWidget, 'treeWidget_prescribed_dofs')
        self.treeWidget_prescribed_dofs.setColumnWidth(0, 80)
        # self.treeWidget_prescribed_dofs.setColumnWidth(1, 60)
        self.treeWidget_prescribed_dofs.itemClicked.connect(self.on_click_item)
        self.treeWidget_prescribed_dofs.itemDoubleClicked.connect(self.on_doubleclick_item)

        self.pushButton_constant_value_confirm = self.findChild(QPushButton, 'pushButton_constant_value_confirm')
        self.pushButton_constant_value_confirm.clicked.connect(self.check_constant_values)

        self.pushButton_table_values_confirm = self.findChild(QPushButton, 'pushButton_table_values_confirm')
        self.pushButton_table_values_confirm.clicked.connect(self.check_table_values)

        self.pushButton_data_table_setup = self.findChild(QPushButton, 'pushButton_data_table_setup')
        self.pushButton_data_table_setup.clicked.connect(self.check_table_values)

        self.pushButton_remove_bc_confirm = self.findChild(QPushButton, 'pushButton_remove_bc_confirm')
        self.pushButton_remove_bc_confirm.clicked.connect(self.check_remove_bc_from_node)

        self.pushButton_reset = self.findChild(QPushButton, 'pushButton_reset')
        self.pushButton_reset.clicked.connect(self.reset_all)

        self.update()
        self.load_nodes_info()
        self.exec_()
    def __init__(self, project, opv, *args, **kwargs):
        super().__init__(*args, **kwargs)
        uic.loadUi(
            'data/user_input/ui/Model/Setup/Acoustic/compressorModelInput.ui',
            self)

        icons_path = 'data\\icons\\'
        self.icon = QIcon(icons_path + 'pulse.png')
        self.setWindowIcon(self.icon)

        self.setWindowFlags(Qt.WindowStaysOnTopHint)
        self.setWindowModality(Qt.WindowModal)

        self.opv = opv
        self.opv.setInputObject(self)
        self.node_id = self.opv.getListPickedPoints()

        self.project = project
        self.preprocessor = project.preprocessor
        self.nodes = self.preprocessor.nodes
        self.before_run = project.get_pre_solution_model_checks()

        self.project_folder_path = project.file._project_path
        self.node_acoustic_path = self.project.file._node_acoustic_path
        self.acoustic_folder_path = self.project.file._acoustic_imported_data_folder_path
        self.compressor_excitation_tables_folder_path = get_new_path(
            self.acoustic_folder_path, "compressor_excitation_files")

        self.stop = False
        self.complete = False
        self.aquisition_parameters_processed = False
        self.node_ID_remove = None
        self.remove_message = True

        self.lineEdit_selected_node_ID = self.findChild(
            QLineEdit, 'lineEdit_selected_node_ID')
        self.lineEdit_suction_node_ID = self.findChild(
            QLineEdit, 'lineEdit_suction_node_ID')
        self.lineEdit_discharge_node_ID = self.findChild(
            QLineEdit, 'lineEdit_discharge_node_ID')

        self.lineEdit_frequency_resolution = self.findChild(
            QLineEdit, 'lineEdit_frequency_resolution')
        self.lineEdit_number_of_revolutions = self.findChild(
            QLineEdit, 'lineEdit_number_of_revolutions')

        self.lineEdit_bore_diameter = self.findChild(QLineEdit,
                                                     'lineEdit_bore_diameter')
        self.lineEdit_stroke = self.findChild(QLineEdit, 'lineEdit_stroke')
        self.lineEdit_connecting_rod_length = self.findChild(
            QLineEdit, 'lineEdit_connecting_rod_length')
        self.lineEdit_rod_diameter = self.findChild(QLineEdit,
                                                    'lineEdit_rod_diameter')

        self.lineEdit_pressure_ratio = self.findChild(
            QLineEdit, 'lineEdit_pressure_ratio')
        self.lineEdit_clearance = self.findChild(QLineEdit,
                                                 'lineEdit_clearance')
        self.lineEdit_TDC_crank_angle_1 = self.findChild(
            QLineEdit, 'lineEdit_TDC_crank_angle_1')
        self.lineEdit_TDC_crank_angle_2 = self.findChild(
            QLineEdit, 'lineEdit_TDC_crank_angle_2')
        self.lineEdit_number_of_pistons = self.findChild(
            QLineEdit, 'lineEdit_number_of_pistons')
        self.lineEdit_rotational_speed = self.findChild(
            QLineEdit, 'lineEdit_rotational_speed')
        self.lineEdit_capacity = self.findChild(QLineEdit, 'lineEdit_capacity')
        self.lineEdit_isentropic_exponent = self.findChild(
            QLineEdit, 'lineEdit_isentropic_exponent')
        self.lineEdit_molar_mass = self.findChild(QLineEdit,
                                                  'lineEdit_molar_mass')
        self.lineEdit_pressure_at_suction = self.findChild(
            QLineEdit, 'lineEdit_pressure_at_suction')
        self.lineEdit_temperature_at_suction = self.findChild(
            QLineEdit, 'lineEdit_temperature_at_suction')

        self.radioButton_both_cylinders = self.findChild(
            QRadioButton, 'radioButton_both_cylinders')
        self.radioButton_head_end_cylinder = self.findChild(
            QRadioButton, 'radioButton_head_end_cylinder')
        self.radioButton_crank_end_cylinder = self.findChild(
            QRadioButton, 'radioButton_crank_end_cylinder')

        self.radioButton_both_cylinders.clicked.connect(
            self.radioButtonEvent_compression_setup)
        self.radioButton_head_end_cylinder.clicked.connect(
            self.radioButtonEvent_compression_setup)
        self.radioButton_crank_end_cylinder.clicked.connect(
            self.radioButtonEvent_compression_setup)

        self.radioButton_connected_at_suction_and_discharge = self.findChild(
            QRadioButton, 'radioButton_connected_at_suction_and_discharge')
        self.radioButton_connected_at_suction = self.findChild(
            QRadioButton, 'radioButton_connected_at_suction')
        self.radioButton_connected_at_discharge = self.findChild(
            QRadioButton, 'radioButton_connected_at_discharge')

        self.radioButton_connected_at_suction_and_discharge.clicked.connect(
            self.radioButtonEvent_connections_compressor_to_pipelines)
        self.radioButton_connected_at_suction.clicked.connect(
            self.radioButtonEvent_connections_compressor_to_pipelines)
        self.radioButton_connected_at_discharge.clicked.connect(
            self.radioButtonEvent_connections_compressor_to_pipelines)
        self.connection_at_suction_and_discharge = self.radioButton_connected_at_suction_and_discharge.isChecked(
        )

        self.radioButtonEvent_compression_setup()
        self.radioButtonEvent_connections_compressor_to_pipelines()

        self.comboBox_frequency_resolution = self.findChild(
            QComboBox, 'comboBox_frequency_resolution')
        self.comboBox_frequency_resolution.currentIndexChanged.connect(
            self.comboBox_event_frequency_resolution)

        self.comboBox_stage = self.findChild(QComboBox, 'comboBox_stage')
        self.comboBox_stage.currentIndexChanged.connect(
            self.comboBox_event_stage)
        self.comboBox_event_stage()

        self.spinBox_number_of_points = self.findChild(
            QSpinBox, 'spinBox_number_of_points')
        self.spinBox_number_of_points.valueChanged.connect(
            self.spinBox_event_number_of_points)

        self.spinBox_max_frequency = self.findChild(QSpinBox,
                                                    'spinBox_max_frequency')
        self.spinBox_max_frequency.valueChanged.connect(
            self.spinBox_event_max_frequency)

        self.spinBox_number_of_cylinders = self.findChild(
            QSpinBox, 'spinBox_number_of_cylinders')
        self.spinBox_number_of_cylinders.valueChanged.connect(
            self.spinBox_event_number_of_cylinders)

        self.pushButton_flipNodes = self.findChild(QPushButton,
                                                   'pushButton_flipNodes')
        self.pushButton_flipNodes.clicked.connect(self.flip_nodes)

        self.pushButton_plot_PV_diagram_head_end = self.findChild(
            QPushButton, 'pushButton_plot_PV_diagram_head_end')
        self.pushButton_plot_PV_diagram_head_end.clicked.connect(
            self.plot_PV_diagram_head_end)

        self.pushButton_plot_PV_diagram_crank_end = self.findChild(
            QPushButton, 'pushButton_plot_PV_diagram_crank_end')
        self.pushButton_plot_PV_diagram_crank_end.clicked.connect(
            self.plot_PV_diagram_crank_end)

        self.pushButton_plot_volumetric_flow_rate_at_suction_time = self.findChild(
            QPushButton,
            'pushButton_plot_volumetric_flow_rate_at_suction_time')
        self.pushButton_plot_volumetric_flow_rate_at_suction_time.clicked.connect(
            self.plot_volumetric_flow_rate_at_suction_time)

        self.pushButton_plot_volumetric_flow_rate_at_discharge_time = self.findChild(
            QPushButton,
            'pushButton_plot_volumetric_flow_rate_at_discharge_time')
        self.pushButton_plot_volumetric_flow_rate_at_discharge_time.clicked.connect(
            self.plot_volumetric_flow_rate_at_discharge_time)

        self.pushButton_plot_rod_pressure_load_frequency = self.findChild(
            QPushButton, 'pushButton_plot_rod_pressure_load_frequency')
        self.pushButton_plot_rod_pressure_load_frequency.clicked.connect(
            self.plot_rod_pressure_load_frequency)

        self.pushButton_plot_volumetric_flow_rate_at_suction_frequency = self.findChild(
            QPushButton,
            'pushButton_plot_volumetric_flow_rate_at_suction_frequency')
        self.pushButton_plot_volumetric_flow_rate_at_suction_frequency.clicked.connect(
            self.plot_volumetric_flow_rate_at_suction_frequency)

        self.pushButton_plot_volumetric_flow_rate_at_discharge_frequency = self.findChild(
            QPushButton,
            'pushButton_plot_volumetric_flow_rate_at_discharge_frequency')
        self.pushButton_plot_volumetric_flow_rate_at_discharge_frequency.clicked.connect(
            self.plot_volumetric_flow_rate_at_discharge_frequency)

        self.pushButton_plot_pressure_head_end_angle = self.findChild(
            QPushButton, 'pushButton_plot_pressure_head_end_angle')
        self.pushButton_plot_pressure_head_end_angle.clicked.connect(
            self.plot_pressure_head_end_angle)

        self.pushButton_plot_volume_head_end_angle = self.findChild(
            QPushButton, 'pushButton_plot_volume_head_end_angle')
        self.pushButton_plot_volume_head_end_angle.clicked.connect(
            self.plot_volume_head_end_angle)

        self.pushButton_plot_pressure_crank_end_angle = self.findChild(
            QPushButton, 'pushButton_plot_pressure_crank_end_angle')
        self.pushButton_plot_pressure_crank_end_angle.clicked.connect(
            self.plot_pressure_crank_end_angle)

        self.pushButton_plot_volume_crank_end_angle = self.findChild(
            QPushButton, 'pushButton_plot_volume_crank_end_angle')
        self.pushButton_plot_volume_crank_end_angle.clicked.connect(
            self.plot_volume_crank_end_angle)

        self.pushButton_process_aquisition_parameters = self.findChild(
            QPushButton, 'pushButton_process_aquisition_parameters')
        self.pushButton_process_aquisition_parameters.clicked.connect(
            self.process_aquisition_parameters)

        self.pushButton_confirm = self.findChild(QPushButton,
                                                 'pushButton_confirm')
        self.pushButton_confirm.clicked.connect(self.process_all_inputs)

        self.pushButton_remove_table = self.findChild(
            QPushButton, 'pushButton_remove_table')
        self.pushButton_remove_table.clicked.connect(self.remove_table)

        self.pushButton_reset_node = self.findChild(QPushButton,
                                                    'pushButton_reset_node')
        self.pushButton_reset_node.clicked.connect(self.reset_node)

        self.pushButton_reset_all = self.findChild(QPushButton,
                                                   'pushButton_reset_all')
        self.pushButton_reset_all.clicked.connect(self.reset_all)

        self.pushButton_close = self.findChild(QPushButton, 'pushButton_close')
        self.pushButton_close.clicked.connect(self.force_to_close)

        self.tabWidget_compressor = self.findChild(QTabWidget,
                                                   'tabWidget_compressor')
        self.tabWidget_compressor.currentChanged.connect(self.tabEvent)
        self.tab_setup = self.findChild(QWidget, "tab_setup")
        self.tab_inputs = self.findChild(QWidget, "tab_inputs")
        self.tab_plots = self.findChild(QWidget, "tab_plots")
        self.tab_remove = self.findChild(QWidget, "tab_remove")

        self.treeWidget_compressor_excitation = self.findChild(
            QTreeWidget, 'treeWidget_compressor_excitation')
        self.treeWidget_compressor_excitation.setColumnWidth(0, 70)
        # self.treeWidget_compressor_excitation.setColumnWidth(1, 140)
        self.treeWidget_compressor_excitation.itemClicked.connect(
            self.on_click_item)
        self.treeWidget_compressor_excitation.headerItem().setTextAlignment(
            0, Qt.AlignCenter)
        self.treeWidget_compressor_excitation.headerItem().setTextAlignment(
            1, Qt.AlignCenter)

        self.lineEdit_node_ID_info = self.findChild(QLineEdit,
                                                    'lineEdit_node_ID_info')
        self.lineEdit_table_name_info = self.findChild(
            QLineEdit, 'lineEdit_table_name_info')

        self.writeNodes(self.opv.getListPickedPoints())
        self.spinBox_event_number_of_cylinders()
        self.load_compressor_excitation_tables_info()

        self.exec_()
 def copyTreeProjectFiles(self):
     self.new_project_folder_path = get_new_path(self.new_project_folder,
                                                 self.new_project_name)
     copytree(self.current_project_file_path, self.new_project_folder_path)
示例#23
0
    def __init__(self, project, opv, *args, **kwargs):
        super().__init__(*args, **kwargs)
        uic.loadUi(
            'data/user_input/ui/Model/Setup/Acoustic/acousticpressureInput.ui',
            self)

        icons_path = 'data\\icons\\'
        self.icon = QIcon(icons_path + 'pulse.png')
        self.setWindowIcon(self.icon)

        self.setWindowFlags(Qt.WindowStaysOnTopHint)
        self.setWindowModality(Qt.WindowModal)

        self.opv = opv
        self.opv.setInputObject(self)

        self.project = project
        self.preprocessor = project.preprocessor
        self.before_run = project.get_pre_solution_model_checks()

        self.userPath = os.path.expanduser('~')
        self.new_load_path_table = ""
        self.acoustic_bc_info_path = project.file._node_acoustic_path
        self.acoustic_folder_path = self.project.file._acoustic_imported_data_folder_path
        self.acoustic_pressure_tables_folder_path = get_new_path(
            self.acoustic_folder_path, "acoustic_pressure_files")

        self.nodes_typed = []
        self.inputs_from_node = False
        self.remove_acoustic_pressure = False
        self.acoustic_pressure = None
        self.list_Nones = [None, None, None, None, None, None]

        self.lineEdit_nodeID = self.findChild(QLineEdit, 'lineEdit_nodeID')
        self.lineEdit_acoustic_pressure_real = self.findChild(
            QLineEdit, 'lineEdit_pressure_real')
        self.lineEdit_acoustic_pressure_imag = self.findChild(
            QLineEdit, 'lineEdit_pressure_imag')
        self.lineEdit_load_table_path = self.findChild(QLineEdit,
                                                       'line_load_table_path')

        self.tabWidget_acoustic_pressure = self.findChild(
            QTabWidget, "tabWidget_acoustic_pressure")
        self.tabWidget_acoustic_pressure.currentChanged.connect(
            self.tabEvent_acoustic_pressure)
        self.current_tab = self.tabWidget_acoustic_pressure.currentIndex()
        self.tab_constant_values = self.tabWidget_acoustic_pressure.findChild(
            QWidget, "tab_constant_values")
        self.tab_table_values = self.tabWidget_acoustic_pressure.findChild(
            QWidget, "tab_table_values")
        self.tab_remove = self.tabWidget_acoustic_pressure.findChild(
            QWidget, "tab_remove")

        self.treeWidget_acoustic_pressure = self.findChild(
            QTreeWidget, 'treeWidget_acoustic_pressure')
        self.treeWidget_acoustic_pressure.setColumnWidth(1, 20)
        self.treeWidget_acoustic_pressure.setColumnWidth(2, 80)
        self.treeWidget_acoustic_pressure.itemClicked.connect(
            self.on_click_item)
        self.treeWidget_acoustic_pressure.itemDoubleClicked.connect(
            self.on_doubleclick_item)

        self.toolButton_load_table = self.findChild(QToolButton,
                                                    'toolButton_load_table')
        self.toolButton_load_table.clicked.connect(
            self.load_acoustic_pressure_table)

        self.pushButton_constant_value_confirm = self.findChild(
            QPushButton, 'pushButton_constant_value_confirm')
        self.pushButton_constant_value_confirm.clicked.connect(
            self.check_constant_values)

        self.pushButton_table_values_confirm = self.findChild(
            QPushButton, 'pushButton_table_values_confirm')
        self.pushButton_table_values_confirm.clicked.connect(
            self.check_table_values)
        self.lineEdit_skiprows = self.findChild(QSpinBox, 'spinBox')

        self.pushButton_remove_bc_confirm = self.findChild(
            QPushButton, 'pushButton_remove_bc_confirm')
        self.pushButton_remove_bc_confirm.clicked.connect(
            self.check_remove_bc_from_node)

        self.pushButton_reset = self.findChild(QPushButton, 'pushButton_reset')
        self.pushButton_reset.clicked.connect(self.check_reset)

        self.update()
        self.load_nodes_info()
        self.exec_()
示例#24
0
    def __init__(self, project, opv, *args, **kwargs):
        super().__init__(*args, **kwargs)
        uic.loadUi('data/user_input/ui/Model/Setup/Structural/loadsInput.ui',
                   self)

        icons_path = 'data\\icons\\'
        self.icon = QIcon(icons_path + 'pulse.png')
        self.setWindowIcon(self.icon)

        self.setWindowFlags(Qt.WindowStaysOnTopHint)
        self.setWindowModality(Qt.WindowModal)

        self.opv = opv
        self.opv.setInputObject(self)

        self.project = project
        self.preprocessor = project.preprocessor
        self.before_run = project.get_pre_solution_model_checks()

        self.userPath = os.path.expanduser('~')
        self.new_load_path_table = ""
        self.imported_table_name = ""
        self.structural_bc_info_path = project.file._node_structural_path
        self.structural_folder_path = self.project.file._structural_imported_data_folder_path
        self.nodal_loads_files_folder_path = get_new_path(
            self.structural_folder_path, "nodal_loads_files")

        self.nodes = project.preprocessor.nodes
        self.loads = None
        self.nodes_typed = []
        self.inputs_from_node = False
        self.basenames = []
        self.list_Nones = [None, None, None, None, None, None]

        self.stop = False
        self.list_frequencies = []

        self.lineEdit_nodeID = self.findChild(QLineEdit, 'lineEdit_nodeID')

        self.lineEdit_real_Fx = self.findChild(QLineEdit, 'lineEdit_real_Fx')
        self.lineEdit_real_Fy = self.findChild(QLineEdit, 'lineEdit_real_Fy')
        self.lineEdit_real_Fz = self.findChild(QLineEdit, 'lineEdit_real_Fz')
        self.lineEdit_real_Mx = self.findChild(QLineEdit, 'lineEdit_real_Mx')
        self.lineEdit_real_My = self.findChild(QLineEdit, 'lineEdit_real_My')
        self.lineEdit_real_Mz = self.findChild(QLineEdit, 'lineEdit_real_Mz')

        self.lineEdit_imag_Fx = self.findChild(QLineEdit, 'lineEdit_imag_Fx')
        self.lineEdit_imag_Fy = self.findChild(QLineEdit, 'lineEdit_imag_Fy')
        self.lineEdit_imag_Fz = self.findChild(QLineEdit, 'lineEdit_imag_Fz')
        self.lineEdit_imag_Mx = self.findChild(QLineEdit, 'lineEdit_imag_Mx')
        self.lineEdit_imag_My = self.findChild(QLineEdit, 'lineEdit_imag_My')
        self.lineEdit_imag_Mz = self.findChild(QLineEdit, 'lineEdit_imag_Mz')

        self.list_lineEdit_constant_values = [
            [self.lineEdit_real_Fx, self.lineEdit_imag_Fx],
            [self.lineEdit_real_Fy, self.lineEdit_imag_Fy],
            [self.lineEdit_real_Fz, self.lineEdit_imag_Fz],
            [self.lineEdit_real_Mx, self.lineEdit_imag_Mx],
            [self.lineEdit_real_My, self.lineEdit_imag_My],
            [self.lineEdit_real_Mz, self.lineEdit_imag_Mz]
        ]

        self.lineEdit_path_table_Fx = self.findChild(QLineEdit,
                                                     'lineEdit_path_table_Fx')
        self.lineEdit_path_table_Fy = self.findChild(QLineEdit,
                                                     'lineEdit_path_table_Fy')
        self.lineEdit_path_table_Fz = self.findChild(QLineEdit,
                                                     'lineEdit_path_table_Fz')
        self.lineEdit_path_table_Mx = self.findChild(QLineEdit,
                                                     'lineEdit_path_table_Mx')
        self.lineEdit_path_table_My = self.findChild(QLineEdit,
                                                     'lineEdit_path_table_My')
        self.lineEdit_path_table_Mz = self.findChild(QLineEdit,
                                                     'lineEdit_path_table_Mz')

        self.list_lineEdit_table_values = [
            self.lineEdit_path_table_Fx, self.lineEdit_path_table_Fy,
            self.lineEdit_path_table_Fz, self.lineEdit_path_table_Mx,
            self.lineEdit_path_table_My, self.lineEdit_path_table_Mz
        ]

        self.toolButton_load_Fx_table = self.findChild(
            QToolButton, 'toolButton_load_Fx_table')
        self.toolButton_load_Fy_table = self.findChild(
            QToolButton, 'toolButton_load_Fy_table')
        self.toolButton_load_Fz_table = self.findChild(
            QToolButton, 'toolButton_load_Fz_table')
        self.toolButton_load_Mx_table = self.findChild(
            QToolButton, 'toolButton_load_Mx_table')
        self.toolButton_load_My_table = self.findChild(
            QToolButton, 'toolButton_load_My_table')
        self.toolButton_load_Mz_table = self.findChild(
            QToolButton, 'toolButton_load_Mz_table')

        self.toolButton_load_Fx_table.clicked.connect(self.load_Fx_table)
        self.toolButton_load_Fy_table.clicked.connect(self.load_Fy_table)
        self.toolButton_load_Fz_table.clicked.connect(self.load_Fz_table)
        self.toolButton_load_Mx_table.clicked.connect(self.load_Mx_table)
        self.toolButton_load_My_table.clicked.connect(self.load_My_table)
        self.toolButton_load_Mz_table.clicked.connect(self.load_Mz_table)

        self.Fx_table = None
        self.Fy_table = None
        self.Fz_table = None
        self.Mx_table = None
        self.My_table = None
        self.Mz_table = None

        self.Fx_filename = None
        self.Fy_filename = None
        self.Fz_filename = None
        self.Mx_filename = None
        self.My_filename = None
        self.Mz_filename = None

        self.Fx_basename = None
        self.Fy_basename = None
        self.Fz_basename = None
        self.Mx_basename = None
        self.My_basename = None
        self.Mz_basename = None

        self.tabWidget_nodal_loads = self.findChild(QTabWidget,
                                                    "tabWidget_nodal_loads")
        self.tab_constant_values = self.tabWidget_nodal_loads.findChild(
            QWidget, "tab_constant_values")
        self.tab_table = self.tabWidget_nodal_loads.findChild(
            QWidget, "tab_table")

        self.treeWidget_nodal_loads = self.findChild(QTreeWidget,
                                                     'treeWidget_nodal_loads')
        self.treeWidget_nodal_loads.setColumnWidth(0, 80)
        # self.treeWidget_nodal_loads.setColumnWidth(1, 60)
        self.treeWidget_nodal_loads.itemClicked.connect(self.on_click_item)
        self.treeWidget_nodal_loads.itemDoubleClicked.connect(
            self.on_doubleclick_item)

        self.pushButton_constant_value_confirm = self.findChild(
            QPushButton, 'pushButton_constant_value_confirm')
        self.pushButton_constant_value_confirm.clicked.connect(
            self.check_constant_values)

        self.pushButton_table_values_confirm = self.findChild(
            QPushButton, 'pushButton_table_values_confirm')
        self.pushButton_table_values_confirm.clicked.connect(
            self.check_table_values)

        self.pushButton_remove_bc_confirm = self.findChild(
            QPushButton, 'pushButton_remove_bc_confirm')
        self.pushButton_remove_bc_confirm.clicked.connect(
            self.check_remove_bc_from_node)

        self.pushButton_reset = self.findChild(QPushButton, 'pushButton_reset')
        self.pushButton_reset.clicked.connect(self.reset_all)

        self.update()
        self.load_nodes_info()
        self.exec_()
示例#25
0
    def __init__(self, project, opv, *args, **kwargs):
        super().__init__(*args, **kwargs)
        uic.loadUi('data/user_input/ui/Project/setMeshPropertiesInput.ui',
                   self)

        icons_path = 'pulse\\data\\icons\\'
        self.icon = QIcon(icons_path + 'add.png')
        self.setWindowIcon(self.icon)

        self.project = project
        self.preprocessor = project.preprocessor
        self.opv = opv

        self.opv.setInputObject(self)
        self.setWindowFlags(Qt.WindowStaysOnTopHint)
        self.setWindowModality(Qt.WindowModal)

        self.remesh_to_match_bcs = False
        self.cache_dict_nodes = self.preprocessor.dict_coordinate_to_update_bc_after_remesh.copy(
        )
        self.cache_dict_update_entity_file = self.preprocessor.dict_element_info_to_update_indexes_in_entity_file.copy(
        )
        self.cache_dict_update_element_info_file = self.preprocessor.dict_element_info_to_update_indexes_in_element_info_file.copy(
        )
        self.dict_list_elements_to_subgroups = self.preprocessor.dict_list_elements_to_subgroups.copy(
        )

        # self.config = config
        self.complete = False
        self.create = False
        self.stop = False

        self.currentTab = 0
        self.t0 = 0

        self.userPath = os.path.expanduser('~')
        self.project_file_path = self.project.file._project_path
        self.project_directory = os.path.dirname(self.project_file_path)
        self.project_name = self.project.file._project_name
        self.project_ini = self.project.file._project_base_name
        self.project_ini_file_path = get_new_path(self.project_file_path,
                                                  self.project_ini)
        geometry_tolerance = self.project.file._geometry_tolerance

        self.lineEdit_current_element_size = self.findChild(
            QLineEdit, 'lineEdit_current_element_size')
        self.lineEdit_new_element_size = self.findChild(
            QLineEdit, 'lineEdit_new_element_size')
        self.lineEdit_geometry_tolerance = self.findChild(
            QLineEdit, 'lineEdit_geometry_tolerance')
        self.lineEdit_geometry_tolerance.setText(str(geometry_tolerance))
        self.lineEdit_current_element_size.setDisabled(True)
        self.lineEdit_new_element_size.setDisabled(False)
        self.lineEdit_geometry_tolerance.setDisabled(False)

        if self.project.file.element_size is not None:
            self.lineEdit_current_element_size.setText(
                str(self.project.file.element_size))
            self.current_element_size = self.project.file.element_size

        self.pushButton_confirm_and_generate_mesh = self.findChild(
            QPushButton, 'pushButton_confirm_and_generate_mesh')
        self.pushButton_confirm_and_generate_mesh.clicked.connect(
            self.confirm_and_generate_mesh)

        self.exec_()