当前位置:网站首页>HyperMesh运行脚本文件的几种方法
HyperMesh运行脚本文件的几种方法
2022-07-28 15:23:00 【CaeCoder】
在HM中可以通过如下几种方法运行tcl脚本:
通过File菜单下的子菜单Run > Tcl Script

在ToolBars中使用 Run Tcl Script
通过
View -> Toolbars ->Scripting打开ToolBars工具条,如下:
在ToolBars工具条上点击Run Tcl/Tk Script运行脚本,如下:
source命令
在命令窗口(command window)中运行Tcl / Tk脚本,可使用source命令+脚本文件名,如下:
source test.tcl
注意:source命令有两个变体。
第一个是Tcl command source:它使用小写的s,此命令的参数需要是完整的tcl文件路径。如果未指定路径,则HyperMesh将在当前工作目录中查找,可以使用pwd命令确定该路径。
source C:/My_scripts/test.tcl
第二个是HWT command Source ,使用大写的S。该命令使HyperMesh搜索其预设脚本目录(该脚本目录由TCL_INCLUDE环境变量定义)以查找脚本。例如,搜索名为test.tcl的脚本并运行找到的第一个文件:
::hwt::Source test.tcl
另外,Tcl / Tk要求路径分隔符使用的是**前斜杠/ ,因为后斜杠\ **是特殊的保留字符。
还必须使用**引号“” 或花括号}**来封装包含空格的路径名,例如:
source {C:/Documents and Settings/Paul/My Documents/test.tcl}
在Utility页面下增加按钮
可以在Utility页面下创建一个按钮来运行Tcl / Tk脚本,其通过修改或创建
userpage.mac文件来完成的。例如:
*createbutton(5, "My Script",0,0,10,BLUE,"",EvalTclScript,
"C:/My_scripts/my_script.tcl")
*beginmacro("EvalTclScript")
*evaltclscript($1,0)
*endmacro()
通过命令
*evaltclscript()Tcl / Tk脚本也可以通过使用
* evaltclscript命令在命令文件中运行。这在启动HyperMesh或以批处理模式运行Tcl / Tk脚本时很有用。例如,要在命令文件中运行脚本 my_script.tcl,可以使用:
*evaltclscript("C:/My_scripts/my_script.tcl",0)
通过命令行
–tcl <filename>启动HyperMesh通过命令行方式使用
–tcl <filename>选项调用HyperMesh来运行命令文件。该选项启动一个HyperMesh会话并执行由<filename>指定的脚本。如果脚本中出现* quit,则HyperMesh将退出,否则HyperMesh将保持打开状态。通过
hmbatch –tcl <filename>启动HyperMesh Batch最后一个方法是使用
hmbatch –tcl<filename>以批处理方式调用HyperMesh。 HyperMesh批处理模式不会启动图形显示,因此脚本中需要显示的任何命令都会被忽略,否则会产生错误。脚本完成后,无论脚本中是否存在* quit,HyperMesh都将退出。
扫描下方二维码关注我的微信公众号 - CAE软件二次开发Lab,查看更多精彩文章!

边栏推荐
- One channel encoder, two channels Di speed measurement, RS485 serial port connected to one channel do alarm module ibf151
- 使用py,根据日志记录自动生成周报
- Wei Jianjun couldn't catch up with Li Shufu by riding a BMW
- LwIP development | realize TCP server through socket
- 深入理解Istio流量管理的熔断配置
- 2-channel Di high-speed pulse counter, 1-channel encoder to Modbus TCP wired wireless module ibf161
- Summary of for loop in JS
- Reentrant and non reentrant
- 视频号找到金钥匙,抖音模仿后来人
- Zhengda cup hacker marathon data analysis competition
猜你喜欢

动态规划 --- 数位统计DP

Connection and application of portable borehole inclinometer data acquisition instrument and inclinometer probe

2021 Kent interview question 1

Rust Getting Started Guide (crite Management)

Deeply understand the fusing configuration of istio traffic management

Instructions for mictr01 Tester development kit (vibrating wire acquisition reader)

How to measure the vibrating wire sensor by vibrating wire acquisition module?

【Multisim仿真】LM339过零电路仿真

Is MySQL query limit 1000,10 as fast as limit 10? If I want to page, what should I do?

Stm32cube infrared remote control: input capture
随机推荐
The little red book of accelerating investment, "rush to medical treatment"?
Automatic conversion and cast
I came across Digital Phoenix coordinate Xuhui Meiluo city in Shanghai
Two of C language programming!! Role of
MySQL view event status statements and modification methods
Temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)
Voltage to current / current to voltage module
Qt学习第一天
I'll show you a little chat! Summary of single merchant function modules
High speed counter to rs485modbus RTU module ibf150
Mlx90640 infrared thermal imager temperature sensor module development notes (VIII)
JS stack
魏建军骑宝马也追不上李书福
SCI scientific paper writing Growth Camp (full version)
Note: the value is rounded up to ten, hundred, thousand, ten thousand
Thoughts on solving the pop-up of malicious computer advertisements
Notes on October 22, 2021
Installation points and precautions of split angle probe
PHP 图片上传
深入理解Istio流量管理的熔断配置