Cache Results in HyperView with Tcl Script
I created a script for creating and caching contour results.
It worked well when the script was run via File>Load>Script in HyperWorks.
However, when the script was run in batch mode, the countour results were not cached.
I would like to know the reason and the solution. Thanks.
Here's the script for caching contour results.
set ui [expr rand()]
hwi OpenStack
hwi GetActiveClientHandle my_client$ui
my_client$ui GetModelHandle my_model$ui [my_client$ui GetActiveModel]
my_model$ui GetResultCtrlHandle my_result$ui
my_result$ui CacheResult scalar
hwi CloseStack
Answers
-
Hello
You can check the start options to run Hyperworks in batch mode. (https://help.altair.com/hwdesktop/hwd/topics/getting_started/start_options_hyperworks_desktop_r.htm)
For Hyperview it is :
<altair_home>/hw/bin/<platform>/hw.exe -clientconfig hwpost.dat -tcl /home/user/my_script.tcl
To debug ,try running the script without the batch mode arguments (-b) and check if the cache results are saved. I would also recommend to create a log file which can help identify the location in your code where your script is failing
Tcl Code example :
Open the log file in write mode (if it exists, it will be truncated; if not, it will be created) set log_file "debug_log.txt" set log_handle [open $log_file "w"]
# Some location in code :
puts $log_handle "Adding contours "
close $log_handle
0 -
Rishabh Awasthi_20948 said:
Hello
You can check the start options to run Hyperworks in batch mode. (https://help.altair.com/hwdesktop/hwd/topics/getting_started/start_options_hyperworks_desktop_r.htm)
For Hyperview it is :
<altair_home>/hw/bin/<platform>/hw.exe -clientconfig hwpost.dat -tcl /home/user/my_script.tcl
To debug ,try running the script without the batch mode arguments (-b) and check if the cache results are saved. I would also recommend to create a log file which can help identify the location in your code where your script is failing
Tcl Code example :
Open the log file in write mode (if it exists, it will be truncated; if not, it will be created) set log_file "debug_log.txt" set log_handle [open $log_file "w"]
# Some location in code :
puts $log_handle "Adding contours "
close $log_handle
Hi, thanks for your reply.
I checked the help file again, and learnt that the cached result function is a run-time feature, which means that it couldn't be saved together with the session file.
So that is the reason why the cached results could be seen when running the results via File>Load>Scripts.
https://help.altair.com/hwdesktop/hwx/topics/panels/contour_panel_caching_results_r.htm
0 -
Rishabh Awasthi_20948 said:
Hello
You can check the start options to run Hyperworks in batch mode. (https://help.altair.com/hwdesktop/hwd/topics/getting_started/start_options_hyperworks_desktop_r.htm)
For Hyperview it is :
<altair_home>/hw/bin/<platform>/hw.exe -clientconfig hwpost.dat -tcl /home/user/my_script.tcl
To debug ,try running the script without the batch mode arguments (-b) and check if the cache results are saved. I would also recommend to create a log file which can help identify the location in your code where your script is failing
Tcl Code example :
Open the log file in write mode (if it exists, it will be truncated; if not, it will be created) set log_file "debug_log.txt" set log_handle [open $log_file "w"]
# Some location in code :
puts $log_handle "Adding contours "
close $log_handle
It seems like that the cached contour results could be save when using upfront loader.
However, the script written with HWC command in tcl wrapper doesn't work well either.
Thanks again. I'll try after the next release of HyperWorks.
0