Jump to content
Alec Maxwell

Automate Hyperview from Hypermesh

Recommended Posts

Hello, 

 

I am attempting to open HyperView and a model and run a TCL script to extract the displacement results from the model that has been loaded. I have been able to open HyperView from HyperMesh and load the correct model, however when it attempts to run the TCL script in HyperView I get the following error message

 

Command line Tcl script read failed.
invalid command name "mpo-9999766"
    while executing
"m$t AddSelectionSet node"
    invoked from within
"m$t GetSelectionSetHandle s$t [m$t AddSelectionSet node]"
    (file "C:/Users/Alec/Desktop/DispVer_HM/results/ExportDisp.tcl" line 6)
    invoked from within
"source "C:/Users/Alec/Desktop/DispVer_HM/results/ExportDisp.tcl""

 

When I run ExportDisp.tcl just in HyperView and the code works perfectly. I have searched the forums to find out why when both pieces of code are run together it does not work. I have attached both scripts and a model in case that will help anybody troubleshoot. ExportDisp.tcl is the script that is designed to be run in HyperView and extract displacement results, and RunHyperView.tcl is run from HyperMesh and used to open HyperView, load model and run ExportDisp.tcl. Thank you in advance for your help.

 

- Alec

 

 

ExportDisp.tcl

RunHyperView.tcl

vf1_min3_dead_s1.h3d

Share this post


Link to post
Share on other sites

Hi, 

 

Thank you for the response, I was able to expand on the code a bit. It now searchers through a results folder and finds all h3d models, and exports the results. However it is only exporting the results from the first iteration. I have searched through the HyperWorks reference guide to try and find a command that could change the iteration to the last iteration, but couldn't not find it. Do you have any suggestions?

 

Thanks

Share this post


Link to post
Share on other sites

Hi Livil,

 

Thank you for you response. 

 

I believe there may be some confusion on what I am looking for. I am loading an h3d file, which contains the displacement values from a static analysis results from one subcase. I am attempting to get the displacement results from the final optimized model. There are two sets of displacement results in the h3d file, one from iteration 0, and one from the last iteration (final optimized model). The problem with my current TCL code that extracts the displacement results is that it exports results from iteration 0, and not the last iteration. I am looking for a TCL command that can find the number of iterations within a subcase, and then can make the last subcase the current subcase. If you have any questions please let me know. Thank you again for you help it is very much appreciated.

 

 

Share this post


Link to post
Share on other sites

Hi Alec,

 

Get result handle poIResultCtrl_handle,  afterwards you will have to do something like below:


 

set lst_subcase [poIResultCtrl_handle GetSubcaseList]
set lst_simulations [poIResultCtrl_handle GetSimulationList [lindex $lst_subcase end]]
poIResultCtrl_handle SetCurrentSimulation [lindex $lst_simulations end]

 

 

 

Share this post


Link to post
Share on other sites

Hi Livil, 

 

Thank you, I really appreciate your help. I see where my confusion was. I didn't think that iterations was the same as simulations. 

 

I had to make a slight change to the commands above, and have included them in this post in case anyone else has similar issues that I had.

 

set lst_subcase [poIResultCtrl_handle  GetSubcaseList]
	
set lst_sim [poIResultCtrl_handle  GetSimulationList [lindex $lst_subcase end]]
	
set LastSim [expr ([llength $lst_sim] - 1)]
    
poIResultCtrl_handle  SetCurrentSimulation $LastSim

 

Thank you again for all of your help with this! 

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.

Guest
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...