Automate Hyperview from Hypermesh
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
Answers
-
Hi,
I found that the model was not loaded in Hyperview, also to query result the contour has to be displayed first. I have fixed some issues, source the attached code, also do modify the location of the h3d file in the script.
0 -
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
0 -
Hi,
You should be able to set it using one of below depending on your need:
poIResultCtrl_handle SetCurrentSimulation index
poIResultCtrl_handle SetCurrentSubcase id
0 -
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.
0 -
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]
0 -
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!
0