Hyperworks批处理调用方法总结

说明:

不同版本可能略有区别。

 一、HyperMesh调用(前处理建模)

1.     方式一:交互模式

"D:\program files\Altair\2019\hm\bin\win64\hmopengl.exe" -tcl FEMmodeling.tcl

2.     方式二:batch模式

"D:\program files\Altair\2019\hm\bin\win64\hmbatch.exe" -tcl FEMmodeling.tcl

3.     方式三:通过hyperworks并指定客户端(client)

"D:\Program Files\Altair\2019\hw\bin\win64\hw.exe" -b -clientconfig hwfepre.dat -tcl FEMmodeling.tcl

      在测试2019版本时,该方法需要提前删除路径下的输出文件(文件无法自动覆盖替换)。

 

上述tcl文件可参考hypermesh软件自动生成command.tcl文件进行修改得到,帮助参考:HyperWorks Desktop Reference Guides->HyperMesh->Scripts->Commands and Fucntions.

 二、HyperView调用(云图后处理)

1.     方式一:调用hwc文件(高版本才有)

"D:\hypermeshinstall\hwdesktop\hw\bin\win64\hw.exe" -b -clientconfig hwpost.dat -hwc test.hwc

该hwc文件可参考hyperview软件自动记录的程序进行选择->右键复制(copy)后得到,例如:

open animation modelandresult "Model_tempDispSteady_1.odb" "Model_tempDispSteady_1.odb"

animate transient time 1

result scalar load type=Displacement

show legends

result scalar load type=Displacement component=X

Hyperworks批处理调用方法总结的图1

      HWC相关帮助说明参考:HyperWorks Desktop Reference Guides->HyperWorks Desktop->HyperWorks Recod and Playback.

 2.     方式二:调用tcl文件(推荐)

"D:\Program Files\Altair\2019\hw\bin\win64\hw.exe" -b -clientconfig hwpost.dat -tcl FEMPost.tcl

该tcl文件需要完全自己手写,例如(截图):

	hwi OpenStack
hwi GetSessionHandle sess
sess CaptureScreen JPEG {myfigure.jpg} 100
hwi CloseStack

tcl命令帮助参考:HyperWorks Desktop Reference Guides->HyperWorks Desktop->Tck/Tk Commands-> Tck/Tk Commands->HyperWorks Desktop 以及 HyperView

也可以参考hyperview软件自动记录的程序(高版本才有)进行选择->右键复制(copy to tcl)后得到,例如:

hwc open animation modelandresult "Model_tempDispSteady_1.odb" "Model_tempDispSteady_1.odb"
hwc animate transient time 1
hwc result scalar load type=Displacement
hwc show legends
hwc result scalar load type=Displacement component=X

上述两种方式的代码可以放在一起使用。

 3.     方式三:调用mvw文件

"D:\Program Files\Altair\2019\hw\bin\win64\hw.exe" -b -clientconfig hwpost.dat -p FEMPost.mvw

mvw为过程记录文件,通过Measure Templex和Note等功能的方式将结果写出到文件中,例如:

step1:新建一个新的measure读取节点232的位移结果(注意measure的编号——按创建组的顺序),当然也可以通过static minmax result;

step2:通过note项添加一个note,并在描述中添加如下命令:

{open “outputs.txt”}

max={p1w1measure3.max}

{close}

获取measure编号为3下的最大值。

step3:操作完成后将该操作过程保存为mvw格式的session文件。 

三、HyperGraph调用(曲线后处理)

Batch:"D:\hypermeshinstall\hwdesktop\hw\bin\win64\hw.exe" -b -clientconfig hwplot.dat -tcl getHistoryData.tcl

Tcl文件示例(获取X-Y曲线):

# hwc hwd window type="HyperGraph 2D"
# 定义文件路径
set cwd [pwd]
set inputFileName Model_tempDispSteady_1.odb
set filePath [file join $cwd $inputFileName]
# 通过HyperGraph built plots
hwc xy load file=$filePath subcase= "Step-tempDispSteady:" ydatatype= "ALLIE-Internal energy (PART-1-1) (Time History)" yrequest= all ycomponent= all
hwc xy load file=$filePath subcase= "Step-tempDispSteady:" ydatatype= "Displacement (PART-FINALLY-1)" yrequest= N380 ycomponent= MAG
# ——————————————————————————————————
# 通过Templex获取曲线的x及y
hwi OpenStack
hwi GetSessionHandle mySessionName
mySessionName GetProjectHandle myProjectName
myProjectName GetTemplexHandle myTemplexName
 
set xlist1 [myTemplexName Evaluate "{(p1w1c2.x)}" true]
set ylist1 [myTemplexName Evaluate "{(p1w1c2.y)}" true]
set numxlist1 [llength $xlist1]
set numylist1 [llength $ylist1]
 
set filename "./results.csv"
set chan [open $filename w]
puts $chan time,ALLIE
for {set i 0} {$i < $numxlist1} {incr i} {    
  set x [string trim [lindex $xlist1 $i] ","]
  set y [string trim [lindex $ylist1 $i] ","]
  puts $chan $x,$y  
}
close $chan
 
myTemplexName ReleaseHandle
myProjectName ReleaseHandle
mySessionName ReleaseHandle
hwi CloseStack

前半部分脚本可参考hyperGraph自动录制的hwc脚本。

登录后免费查看全文
立即登录
App下载
技术邻APP
工程师必备
  • 项目客服
  • 培训客服
  • 平台客服

TOP

2
2