Beispiel #1
0
def convert_calculation_results_in(folder):
    print('CONVERTER TEST\n\n')
    start = time.perf_counter() # start time
    for file_name in scan_all_files_in(folder, '.frd'):
        print('\n' + '='*50)
        ccx2paraview.Converter(file_name, 'vtk').run()
        print('\n' + '='*50)
        ccx2paraview.Converter(file_name, 'vtu').run()
    print('\nTotal {:.1f} seconds'.format(time.perf_counter() - start))
Beispiel #2
0
 def export_vtu(self):
     if os.path.isfile(self.frd):
         ccx2paraview.Converter(self.frd, ['vtu']).run()
     else:
         logging.error('File not found:\n' \
             + self.frd \
             + '\nSubmit analysis first.')
Beispiel #3
0
def run_calculix(input_file, mesh_files_inp):

    name_fild_dir = mesh_files_inp.replace('.inp', '')
    new_name_fil_dir = name_fild_dir.replace('Mesh/', '')

    # Run the CalculiX solver with ccx_2.17_MT command
    subprocess.run(["ccx_2.17_MT", input_file])
    os.mkdir("Results/" + new_name_fil_dir)

    #Variables for copying/saving files
    frd_result_file = input_file + ".frd"
    #dat_result_file = input_file + ".dat"
    vtu_result_file = input_file + ".vtu"

    #convert .frd to .vtu
    logging.basicConfig(level=logging.INFO,
                        format='%(levelname)s: %(message)s')
    conversion = ccx2paraview.Converter(frd_result_file, ['vtu'])
    conversion.run()

    frd_new_name = new_name_fil_dir + ".frd"
    #dat_new_name = new_name_fil_dir + ".dat"
    vtu_new_name = new_name_fil_dir + ".vtu"

    frd_dir = "Results/" + new_name_fil_dir + "/" + frd_new_name
    #dat_dir = "Results/" + new_name_fil_dir + "/" + dat_new_name
    vtu_dir = "Results/" + new_name_fil_dir + "/" + vtu_new_name

    # Copy the results files
    shutil.copyfile(frd_result_file, frd_dir)
    #shutil.copyfile(dat_result_file, dat_dir)
    shutil.copyfile(vtu_result_file, vtu_dir)
Beispiel #4
0
def convert_calculation_results_in(folder):
    print('CONVERTER TEST\n\n')
    counter = 0
    for file_name in scan_all_files_in(folder, '.frd'):
        counter += 1
        relpath = os.path.relpath(file_name, start=folder)
        print('\n{}\n{}: {}'.format('=' * 50, counter, relpath))
        try:
            ccx2paraview.Converter(file_name, ['vtk', 'vtu']).run()
        except:
            logging.error(traceback.format_exc())