tecplot GUI 可以正常使用,点击了 accept pytecplot connection,但运行Python程序时总显示license related 错误,重新安装了一个较高版本(2018R1),报错中终于不是license related的错误了,但仍有错误,似乎与pytecplot包有关。于是在程序中添加了关键语句:tp.session.connect(port=7600)。终于,操作成功!
官方给的hello world教程:https://www.tecplot.com/docs/pytecplot/examples.html#hello-world
import logging logging.basicConfig(level=logging.DEBUG) import tecplot # Run this script with "-c" to connect to Tecplot 360 on port 7600 # To enable connections in Tecplot 360, click on: # "Scripting" -> "PyTecplot Connections..." -> "Accept connections" import sys if '-c' in sys.argv: tecplot.session.connect() tecplot.new_layout() frame = tecplot.active_frame() frame.add_text('Hello, World!', position=(36, 50), size=34) tecplot.export.save_png('hello_world.png', 600, supersample=3)
运行之后一大堆错误,更改代码为:
import sys
#import logging
#logging.basicConfig(level=logging.DEBUG)
from os import path
import tecplot as tp
from tecplot.constant import *
tp.session.connect(port=7600)
tp.new_layout()
frame=tp.active_frame()
frame.add_text('hello world!',position=(36,50),size=34)
tp.export.save_png('hello.png',600,supersample=3)
运行成功!