pytecplot

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)

运行成功!

 

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
要安装pytecplot,您需要按照以下步骤进行操作: 1. 首先,确保您已经安装了Tecplot软件。pytecplot是Tecplot的Python接口,因此需要Tecplot软件的支持。 2. 在安装Tecplot之后,您需要安装pytecplot库。您可以使用pip命令来安装pytecplot。打开终端或命令提示符,输入以下命令: ``` pip install pytecplot ``` 这将自动下载并安装pytecplot库及其依赖项。 3. 安装完成后,您可以在Python脚本中导入pytecplot库并开始使用它。在您的Python脚本中,您可以使用如下语句导入pytecplot库: ``` import tecplot ``` 这将使您可以在脚本中使用pytecplot的功能和方法。 引用中提供了一个使用pytecplot的示例程序。您可以根据您的需要修改该示例程序。此示例程序将创建一个Tecplot布局,向其添加文本并将布局保存为PNG文件。您可以根据自己的需求进行更改和扩展。 请注意,如果您在运行程序时遇到许可证错误,请确保您已经正确安装并获得了Tecplot软件的许可证。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [pytecplot 的安装与启动(tecplot GUI能用但是pytecplot不能用)](https://blog.csdn.net/gifterxian/article/details/106976259)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值