set model_name {G:\ZhengTi_AnsysModel.cdb}
set result_name {D:\E3_mode_zheng.txt}
# set window
hwc delete session
hwi CloseStack
hwi OpenStack
hwi GetSessionHandle session_handle
session_handle GetProjectHandle project_handle
project_handle GetPageHandle page_handle [project_handle GetActivePage]
page_handle GetWindowHandle window_handle [page_handle GetActiveWindow]
window_handle GetClientHandle client_handle
window_handle SetClientType Animation
window_handle GetViewControlHandle viewctrl_handle
client_handle GetNoteHandle note_handle 1
# add model and result
cd [file dirname $model_name]
set id [client_handle AddModel $model_name]
client_handle GetModelHandle model_handle [client_handle GetActiveModel]
model_handle SetResult $result_name
model_handle GetResultCtrlHandle result_handle
result_handle GetContourCtrlHandle contour_handle
contour_handle GetLegendHandle legend_handle
#=============================================== 自动
note_handle SetVisibility false
contour_handle SetDataType "Displacement"
contour_handle SetDataComponent "Mag"
contour_handle SetEnableState true
contour_handle SetResultSystem 0
legend_handle SetPosition upperleft
legend_handle SetNumericPrecision 2
legend_handle SetMinMaxVisibility False
hwc result scalar legend title visibility=false
hwc show legends
hwc result scalar legend title visibility=false
client_handle Draw
#=============================================== 自动
#=============================================== 手动
# 手动绘制云图调整 deformation,colorbar,mesh,note,system
#=============================================== 手动
# output mode shape batch
set simuList [result_handle GetSimulationList 1]
for { set jj 0} {$jj < [llength $simuList]} {incr jj} {
result_handle SetCurrentSimulation $jj
# contour_handle SetDataType "Eigen Mode"
contour_handle SetDataType "Displacement"
contour_handle SetDataComponent "Mag"
contour_handle SetEnableState true
contour_handle SetResultSystem 0
client_handle Draw
# viewctrl_handle Fit
set simu [lindex $simuList $jj]
client_handle CaptureImage "ModeXdd--$simu.png" PNG 1
}
puts "pic ok"