Jump to content

Hyperview TCL command to retrieve max displacement per subcase

Recommended Posts

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.

Share this post

Link to post
Share on other sites

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.


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...