HyperView二次開發(fā)實(shí)例2

HyperView二次開發(fā)實(shí)例2

以下Tcl腳本用于在HyperView中自動(dòng)截圖。

 

#設(shè)置名稱

set proc_name "jpeg_capture"

#獲得Session Handle

hwi GetSessionHandle sess

 

if {[catch {

 

 # Get a post object handle

 sess GetProjectHandle proj

 proj GetPageHandle page [proj GetActivePage]

 page GetWindowHandle win [page GetActiveWindow]

 win SetClientType "Animation"

 win GetClientHandle post

 #以上幾行獲得各級(jí)Handle

 # 加載模型和結(jié)果

 set myfile "d:/samples/dyna/bumper_foam/d3plot"

 set model_id [post AddModel $myfile]

 post GetModelHandle mod $model_id

 mod SetResult $myfile

 

 # 指定顯示最后frame的結(jié)果

 page GetAnimatorHandle animator

 animator SetAnimationMode "transient"

 animator SetCurrentStep [expr [animator GetNumberOfSteps]-1]

 

 #設(shè)置結(jié)果顯示

 mod GetResultCtrlHandle res

 mod ReleaseHandle

 res GetContourCtrlHandle contour_ctrl

 res ReleaseHandle

 contour_ctrl SetEnableState true

 post SetDisplayOptions "contour" true   #顯示云圖

 post SetDisplayOptions "legend" true    #顯示legend

 

#顯示結(jié)果類型

 contour_ctrl SetDataType $datatype

 contour_ctrl SetShellLayer "max"

 contour_ctrl SetDimensionEnabled shell true

 contour_ctrl SetDataComponent shell "P1"

 contour_ctrl SetDimensionEnabled solid true

 contour_ctrl SetDataComponent solid "P1"

 post Draw

#自動(dòng)截圖

 sess CaptureScreen "jpeg" "$tag-$datatype.jpg"

 

#顯示位移

 set datatype "displacement"

 contour_ctrl SetDataType $datatype

 post Draw

#自動(dòng)截圖

 sess CaptureScreen "jpeg" "$tag-$datatype.jpg"

 

#釋放Handle

 contour_ctrl ReleaseHandle

 post ReleaseHandle

 page ReleaseHandle

 sess ReleaseHandle

         

} result]}

 # Error handling

 set msg "Error occured running $proc_name\n\n[sess GetError]"

 tk_messageBox -title "Error running script" -message $msg

}

 

登錄后免費(fèi)查看全文
立即登錄
App下載
技術(shù)鄰APP
工程師必備
  • 項(xiàng)目客服
  • 培訓(xùn)客服
  • 平臺(tái)客服

TOP

2
2
1