Hyperview TCL command to retrieve max displacement per subcase

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

I have a results file with 120 subcases.  Each subcase has its own contour plot and results.  I want to retrieve the max displacement for each subcase and write it to a file without having to view each subcase.  Ideally, I would like the legend value of the displacement to be 'fixed' not 'scientific'.   I've written a couple TCL scripts for Hypermesh, and am familiar with the puts for writing to the file, but have no idea what any of the commands are for the hyperview tcl.

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited August 2018

    Here's an example of script to export all displacements of all subcase into file:

     hwi OpenStack; set hn [hwi ListAllHandles]; foreach hn1 $hn { 	catch {$hn1 ReleaseHandle} }  hwi ReleaseAllHandles   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 client_handle GetModelHandle model_handle [client_handle GetActiveModel] model_handle GetResultCtrlHandle result_handle model_handle GetQueryCtrlHandle query_handle  model_handle GetSelectionSetHandle set_handle [model_handle AddSelectionSet node] set_handle Add all   set mydir {C:/Users/TOTO}  set num_subcase [result_handle GetNumberOfSubcases 'Base'] for {set i 1} { $i <= $num_subcase} {incr i} { 	puts 'Subcase $i' 	result_handle SetCurrentSubcase $i 	result_handle SetCurrentSimulation 1   	query_handle SetDataSourceProperty result datatype 'Displacements' 	query_handle SetQuery 'node.id,node.coords,result.value' 	query_handle SetSelectionSet [set_handle GetID]; 	set output [format '%s/displacement_subcase%d.csv' $mydir $i] 	query_handle WriteData $output; }  hwi CloseStack

    This script is not tested yet. But maybe it can give you some ideas.