Hyperworks批處理調(diào)用方法總結(jié)
說(shuō)明:
不同版本可能略有區(qū)別。
一、HyperMesh調(diào)用(前處理建模)
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. 方式三:通過(guò)hyperworks并指定客戶(hù)端(client)
"D:\Program Files\Altair\2019\hw\bin\win64\hw.exe" -b -clientconfig hwfepre.dat -tcl FEMmodeling.tcl
在測(cè)試2019版本時(shí),該方法需要提前刪除路徑下的輸出文件(文件無(wú)法自動(dòng)覆蓋替換)。
上述tcl文件可參考hypermesh軟件自動(dòng)生成command.tcl文件進(jìn)行修改得到,幫助參考:HyperWorks Desktop Reference Guides->HyperMesh->Scripts->Commands and Fucntions.
二、HyperView調(diào)用(云圖后處理)
1. 方式一:調(diào)用hwc文件(高版本才有)
"D:\hypermeshinstall\hwdesktop\hw\bin\win64\hw.exe" -b -clientconfig hwpost.dat -hwc test.hwc
該hwc文件可參考hyperview軟件自動(dòng)記錄的程序進(jìn)行選擇->右鍵復(fù)制(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

HWC相關(guān)幫助說(shuō)明參考:HyperWorks Desktop Reference Guides->HyperWorks Desktop->HyperWorks Recod and Playback.
2. 方式二:調(diào)用tcl文件(推薦)
"D:\Program Files\Altair\2019\hw\bin\win64\hw.exe" -b -clientconfig hwpost.dat -tcl FEMPost.tcl
該tcl文件需要完全自己手寫(xiě),例如(截圖):
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軟件自動(dòng)記錄的程序(高版本才有)進(jìn)行選擇->右鍵復(fù)制(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. 方式三:調(diào)用mvw文件
"D:\Program Files\Altair\2019\hw\bin\win64\hw.exe" -b -clientconfig hwpost.dat -p FEMPost.mvw
mvw為過(guò)程記錄文件,通過(guò)Measure Templex和Note等功能的方式將結(jié)果寫(xiě)出到文件中,例如:
step1:新建一個(gè)新的measure讀取節(jié)點(diǎn)232的位移結(jié)果(注意measure的編號(hào)——按創(chuàng)建組的順序),當(dāng)然也可以通過(guò)static minmax result;
step2:通過(guò)note項(xiàng)添加一個(gè)note,并在描述中添加如下命令:
{open “outputs.txt”}
max={p1w1measure3.max}
{close}
獲取measure編號(hào)為3下的最大值。
step3:操作完成后將該操作過(guò)程保存為mvw格式的session文件。
三、HyperGraph調(diào)用(曲線(xiàn)后處理)
Batch:"D:\hypermeshinstall\hwdesktop\hw\bin\win64\hw.exe" -b -clientconfig hwplot.dat -tcl getHistoryData.tcl
Tcl文件示例(獲取X-Y曲線(xiàn)):
# hwc hwd window type="HyperGraph 2D"
# 定義文件路徑
set cwd [pwd]
set inputFileName Model_tempDispSteady_1.odb
set filePath [file join $cwd $inputFileName]
# 通過(guò)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
# ——————————————————————————————————
# 通過(guò)Templex獲取曲線(xiàn)的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自動(dòng)錄制的hwc腳本。
工程師必備
- 項(xiàng)目客服
- 培訓(xùn)客服
- 平臺(tái)客服
TOP




















