def test_tecplot_02(self): """CTETRA10 elements""" log = SimpleLogger(level='warning') nastran_filename1 = os.path.join(NASTRAN_MODEL_PATH, 'solid_bending', 'solid_bending.bdf') nastran_filename2 = os.path.join(NASTRAN_MODEL_PATH, 'solid_bending', 'solid_bending2.bdf') tecplot_filename = os.path.join(NASTRAN_MODEL_PATH, 'solid_bending', 'solid_bending.plt') tecplot_filename2 = os.path.join(NASTRAN_MODEL_PATH, 'solid_bending', 'solid_bending2.plt') unused_tecplot = nastran_to_tecplot_filename(nastran_filename1, tecplot_filename, log=log) #tecplot.write_tecplot(tecplot_filename) tecplot_to_nastran_filename(tecplot_filename, nastran_filename2, log=log) #os.remove(nastran_filename2) #os.remove(tecplot_filename) bdf_model = read_bdf(nastran_filename1, log=log) unused_tecplot = nastran_to_tecplot(bdf_model) argv = [ 'format_converter', 'tecplot', tecplot_filename, 'tecplot', tecplot_filename2 ] cmd_line_format_converter(argv=argv, quiet=True)
def _test_tecplot_02(self): nastran_filename1 = os.path.join(nastran_path, 'solid_bending', 'solid_bending.bdf') nastran_filename2 = os.path.join(nastran_path, 'solid_bending', 'solid_bending2.bdf') tecplot_filename = os.path.join(nastran_path, 'solid_bending', 'solid_bending.plt') tecplot = nastran_to_tecplot_filename(nastran_filename1, tecplot_filename) tecplot_to_nastran_filename(tecplot_filename, nastran_filename2)
def process_tecplot(tecplot_filename: str, fmt2: str, fname2: str, log: SimpleLogger, data: Optional[Dict[str, Any]]=None, quiet: bool=False) -> None: """ Converts Tecplot to Tecplot Globs all input tecplot files (e.g. tecplot*.plt) """ assert fmt2 in ['stl', 'nastran', 'cart3d', 'tecplot'], 'format2=%s' % fmt2 if '*' in tecplot_filename: tecplot_filenames = glob.glob(tecplot_filename) else: tecplot_filenames = [tecplot_filename] assert len(tecplot_filenames) > 0, tecplot_filename from pyNastran.converters.tecplot.utils import merge_tecplot_files from pyNastran.converters.tecplot.tecplot_to_nastran import tecplot_to_nastran_filename from pyNastran.converters.tecplot.tecplot_to_cart3d import tecplot_to_cart3d_filename model = merge_tecplot_files(tecplot_filenames, tecplot_filename_out=None, log=log) #if fmt2 == 'cart3d': #tecplot_to_cart3d(model, fname2) #elif fmt2 == 'stl': #tecplot_to_stl(model, fname2) # elif fmt2 == 'ugrid': # tecplot_to_ugrid(model, fname2) res_types = data['RESTYPE'] unused_is_points = not data['--block'] if fmt2 == 'tecplot': if not quiet: # pragma: no cover print(data) element_slice(model, data) # this is a good way to merge files model.write_tecplot(fname2, res_types=res_types) # is_points=is_points elif fmt2 == 'nastran': tecplot_to_nastran_filename(model, fname2) elif fmt2 == 'stl': cart3d_filename = fname2 + '.tri' tecplot_to_cart3d_filename(model, cart3d_filename, log=log) process_cart3d(cart3d_filename, fmt2, fname2, log, data=data, quiet=quiet) os.remove(cart3d_filename) #tecplot_to_nastran_filename(model, fname2 + '.bdf') #process_nastran(fname2 + '.bdf', fmt2, fname2, log, data=data, quiet=quiet) elif fmt2 == 'cart3d': # supports tris/quads, not loads #tecplot_to_nastran_filename(model, fname2 + '.bdf') #process_nastran(fname2 + '.bdf', fmt2, fname2, log, data=data, quiet=quiet) # supports quads/loads, not tris tecplot_to_cart3d_filename(model, fname2, log=log) else: raise NotImplementedError('fmt2=%s is not supported by process_tecplot' % fmt2)
def test_tecplot_02(self): log = get_logger(level='warning') nastran_filename1 = os.path.join(NASTRAN_MODEL_PATH, 'solid_bending', 'solid_bending.bdf') nastran_filename2 = os.path.join(NASTRAN_MODEL_PATH, 'solid_bending', 'solid_bending2.bdf') tecplot_filename = os.path.join(NASTRAN_MODEL_PATH, 'solid_bending', 'solid_bending.plt') tecplot = nastran_to_tecplot_filename(nastran_filename1, tecplot_filename, log=log) #tecplot.write_tecplot(tecplot_filename) tecplot_to_nastran_filename(tecplot_filename, nastran_filename2, log=log)
def process_tecplot(tecplot_filename, fmt2, fname2, data=None): """ Converts Tecplot to Tecplot Globs all input tecplot files (e.g. tecplot*.plt) """ assert fmt2 in ['stl', 'nastran', 'cart3d', 'tecplot'], 'format2=%s' % fmt2 if '*' in tecplot_filename: tecplot_filenames = glob.glob(tecplot_filename) else: tecplot_filenames = [tecplot_filename] assert len(tecplot_filenames) > 0, tecplot_filename from pyNastran.converters.tecplot.utils import merge_tecplot_files from pyNastran.converters.tecplot.tecplot_to_nastran import tecplot_to_nastran_filename from pyNastran.converters.tecplot.tecplot_to_cart3d import tecplot_to_cart3d_filename model = merge_tecplot_files(tecplot_filenames, tecplot_filename_out=None) #if fmt2 == 'cart3d': #tecplot_to_cart3d(model, fname2) #elif fmt2 == 'stl': #tecplot_to_stl(model, fname2) # elif fmt2 == 'ugrid': # tecplot_to_ugrid(model, fname2) res_types = data['RESTYPE'] is_points = not data['--block'] if fmt2 == 'tecplot': print(data) element_slice(model, data) # this is a good way to merge files model.write_tecplot(fname2, res_types=res_types, is_points=is_points) elif fmt2 == 'nastran': tecplot_to_nastran_filename(model, fname2) elif fmt2 == 'stl': tecplot_to_nastran_filename(model, fname2 + '.bdf') process_nastran(fname2 + '.bdf', fmt2, fname2, data=data) elif fmt2 == 'cart3d': # supports tris/quads, not loads tecplot_to_nastran_filename(model, fname2 + '.bdf') process_nastran(fname2 + '.bdf', fmt2, fname2, data=data) # supports quads/loads, not tris #tecplot_to_cart3d_filename(model, fname2) else: raise NotImplementedError(fmt2)
def process_tecplot(tecplot_filename, fmt2, fname2, data=None): """ Converts Tecplot to Tecplot Globs all input tecplot files (e.g. tecplot*.plt) """ assert fmt2 in ['stl', 'nastran', 'cart3d', 'tecplot'], 'format2=%s' % fmt2 if '*' in tecplot_filename: tecplot_filenames = glob.glob(tecplot_filename) else: tecplot_filenames = [tecplot_filename] assert len(tecplot_filenames) > 0, tecplot_filename model = merge_tecplot_files(tecplot_filenames, tecplot_filename_out=None) #if fmt2 == 'cart3d': #tecplot_to_cart3d(model, fname2) #elif fmt2 == 'stl': #tecplot_to_stl(model, fname2) # elif fmt2 == 'ugrid': # tecplot_to_ugrid(model, fname2) res_types = data['RESTYPE'] is_points = not data['--block'] if fmt2 == 'tecplot': print(data) element_slice(model, data) # this is a good way to merge files model.write_tecplot(fname2, res_types=res_types, is_points=is_points) elif fmt2 == 'nastran': tecplot_to_nastran_filename(model, fname2) elif fmt2 == 'stl': tecplot_to_nastran_filename(model, fname2 + '.bdf') process_nastran(fname2 + '.bdf', fmt2, fname2, data=data) elif fmt2 == 'cart3d': # supports tris/quads, not loads tecplot_to_nastran_filename(model, fname2 + '.bdf') process_nastran(fname2 + '.bdf', fmt2, fname2, data=data) # supports quads/loads, not tris #tecplot_to_cart3d_filename(model, fname2) else: raise NotImplementedError(fmt2)
def _test_tecplot_02(self): nastran_filename1 = os.path.join(nastran_path, 'solid_bending', 'solid_bending.bdf') nastran_filename2 = os.path.join(nastran_path, 'solid_bending', 'solid_bending2.bdf') tecplot_filename = os.path.join(nastran_path, 'solid_bending', 'solid_bending.plt') tecplot = nastran_to_tecplot_filename(nastran_filename1, tecplot_filename) tecplot_to_nastran_filename(tecplot_filename, nastran_filename2)