how to use tcl script to query on hyperview session

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

Understanding that there is an Tcl/TK Commands GUI, I do not want to use the interactive interface because our need is to avoid the GUI.

 

I thought I should use the post package in my tcl script. Somehow I can not even bring in the post package.

 

I wonder if there is another way around to query HyperView session, which should work just like Abaqus CAE.

 

Thank you all for your expertise.

 

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited December 2014

    Hi

    Check reference guide about hwi class which handle hyperview sessions

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2014

    Thanks for your reply. I looked at this hwi class previously, but did not figure it out yet. hwi is the interface on hyperview session. However my requirement is NOT to use the interface explicitly. Does anybody have experience in coding a standard alone tcl script utilizing the hwi class?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2014

    Hi Folks, I appreciate the expertise on how to use Hyperworks Command API in batch mode.

     

    Here is a set of hwi query commands I tested in the HW Tcl/Tk Command interactive API:

     

    proc hwi_query {} {
     hwi GetSessionHandle my_sess
     my_sess GetProjectHandle my_proj
     my_proj GetPageHandle my_page [proj GetActivePage]
     my_page GetWindowHandle my_win 1
     my_win GetClientHandle my_post
     my_win ReleaseHandle
     my_post GetModelHandle my_mod 1
     my_mod GetResultCtrlHandle my_res
     my_mod GetQueryCtrlHandle my_query

     my_res GetSubcaseList
     my_res GetCurrentSubcase
     my_res GetSubcaseType 1
     my_res GetDataTypeList 1
     my_res GetContourCtrlHandle my_contour_ctrl
     my_contour_ctrl GetDataType
     my_query GetDataSourceFieldList node
     my_query GetDataSourceFieldDescriptionList node
     my_query GetDataSourcePropertyList node
     my_query SetQuery 'node.id node.coords'
     my_query SetDataSourceProperty node id 576394
     my_query GetIteratorHandle my_handle
     for { my_handle First }  { [my_handle Valid] } { my_handle Next } {puts $fp_out  'data is  [my_handle GetDataList]'}
    }

     

    The above query is successful through the API.

     

    However my task is to NOT use the API explicitly. Instead I hope to pack this query in a tcl script. This tcl script will be invoked in HW batch mode:

     

    /Altair_dir/hw.exe -f my_ODB_file.odb -tcl my_hwi_query_command.tcl

     

    The problem is that these query commands are NOT fed to the API. Apparently I do not know if and how I get a handle to the API in batch mode.

     

    Thank you folks if you have any suggestion.