当前位置:网站首页>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,查看更多精彩文章!

边栏推荐
- PHP 图片上传
- Leetcode topic
- 资本「断供」两年,我只能把公司卖了
- One channel encoder, two channels Di speed measurement, RS485 serial port connected to one channel do alarm module ibf151
- Qt学习第一天
- 李宏毅《机器学习》丨5. Tips for neural network design(神经网络设计技巧)
- How to measure the vibrating wire sensor by vibrating wire acquisition module?
- 加速投资的小红书,“病急乱投医”?
- 后台弹出layer提示
- 带你来浅聊一下!单商户功能模块汇总
猜你喜欢

Why do most people who learn programming go to Shenzhen and Beijing?

Thoughts on solving the pop-up of malicious computer advertisements

2021 亚鸿笔试题

flashfxp 530 User cannot log in. ftp

Record doc

Temperature measurement and imaging accuracy of ifd-x micro infrared imager (module)

Redis series 4: sentinel (sentinel mode) with high availability

About standard IO buffers

Zhengda cup hacker marathon data analysis competition

High precision absolute angle sensor application high speed angle monitoring
随机推荐
Writing of factorial
Application of optical rain gauge to rainfall detection
How to measure the vibrating wire sensor by vibrating wire acquisition module?
flashfxp 530 User cannot log in. ftp
500million users, four years earlier than wechat... This app, which has been in operation for 15 years, will be permanently discontinued
1. Simple command line connection to database
laravel
CoDeSys realizes bubble sorting
JS linked list 02
R language uses file of FS package_ Delete function deletes the specified file under the specified folder, draw inferences from one instance, dir_ Delete function, link_ The delete function can be use
Qt学习之安装
小程序中的分页查询
Brief tutorial for soft exam system architecture designer | software debugging
About standard IO buffers
Zhengda cup hacker marathon data analysis competition
头条文章_signature
A program for judging the result of cyclic input
R language uses ggpairs function of ggally package to visualize pairwise relationship graph of grouping multivariable, set alpha parameter to change image transparency, diagonal continuous variable de
深入理解Istio流量管理的熔断配置
I'll show you a little chat! Summary of single merchant function modules