def process_cart3d(cart3d_filename, fmt2, fname2, log, data, quiet=False): """ Converts Cart3d to STL/Nastran/Tecplot/Cart3d """ assert fmt2 in ['stl', 'nastran', 'tecplot', 'cart3d'], 'format2=%s' % fmt2 from pyNastran.converters.cart3d.cart3d import read_cart3d model = read_cart3d(cart3d_filename, log=log) if data['--scale'] != 1.0: model.points *= data['--scale'] data['--scale'] = 1.0 if fmt2 == 'stl': from pyNastran.converters.cart3d.cart3d_to_stl import cart3d_to_stl_filename cart3d_to_stl_filename(model, fname2, log=log, is_binary=data['--binary']) elif fmt2 == 'nastran': from pyNastran.converters.cart3d.cart3d_to_nastran import cart3d_to_nastran_filename cart3d_to_nastran_filename(model, fname2, log=log) elif fmt2 == 'tecplot': from pyNastran.converters.cart3d.cart3d_to_tecplot import cart3d_to_tecplot cart3d_to_tecplot(model, fname2, log=log) elif fmt2 == 'cart3d': model.write_cart3d(fname2, is_binary=data['--binary']) # elif fmt2 == 'ugrid': # cart3d_to_ugrid(model, fname2) else: raise NotImplementedError( 'fmt2=%s is not supported by process_cart3d' % fmt2)
def process_cart3d(cart3d_filename, fmt2, fname2, data): """ Converts Cart3d to STL/Nastran/Tecplot/Cart3d """ assert fmt2 in ['stl', 'nastran', 'tecplot', 'cart3d'], 'format2=%s' % fmt2 model = read_cart3d(cart3d_filename) if data['--scale'] != 1.0: model.points *= data['--scale'] data['--scale'] = 1.0 if fmt2 == 'stl': cart3d_to_stl_filename(model, fname2, is_binary=data['--binary']) elif fmt2 == 'nastran': cart3d_to_nastran_filename(model, fname2) elif fmt2 == 'tecplot': cart3d_to_tecplot(model, fname2) elif fmt2 == 'cart3d': model.write_cart3d(fname2, is_binary=data['--binary']) # elif fmt2 == 'ugrid': # cart3d_to_ugrid(model, fname2) else: raise NotImplementedError(fmt2)
def test_cart3d_to_tecplot(self): """convert to tecplot""" log = get_logger(level='warning', encoding='utf-8') cart3d_filename = os.path.join(TEST_PATH, 'threePlugs.bin.tri') tecplot_filename = os.path.join(TEST_PATH, 'threePlugs.plt') cart3d_to_tecplot(cart3d_filename, tecplot_filename, log=log)