Script for exporting vonMises of components

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

Dear All,


In my current project I have 21 different components of which I have to obtain the average vonMises stress of the shell elements inside the components, resulting in 21 different values. I would like to run multiple analyses with different thicknesses and material properties. To make the process faster, I would like to create a TCL script which would be able to obtain the average vonMises of each component and write it out to a file. Could someone suggest a source that would help me get started?

Kind Regards,
Balazs

Tagged:

Answers

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited June 2019

    Hi Balazs,

     

    You can check out scripts in Script Exchange, just filter out Hyperview as in attached image.

    https://connect.altair.com/CP/script-list.html

     

    Do note that HyperView scripting does require practice in getting correct handles and hierarchy. I have written some easy scripts in this forums earlier which can be a good reference to begin with. 

    image.png.98a23261fca261424818ca3c247eae7c.png

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2019

    Dear Livil,
    Thank you for your reply! I am trying to get a deeper look into the language, but I have met a barrier that you might be able to explain. I am trying to run the following code to obtain the element id and contour value:

     

    hwi OpenStack

    set t [clock clicks]

    hwi GetSessionHandle session
    session GetProjectHandle project
    project GetPageHandle page 1
    page GetWindowHandle win 1
    win GetClientHandle anim
    anim GetModelHandle my_model [anim GetActiveModel]
    my_model GetQueryCtrlHandle my_query

     

    set set_id [my_model AddSelectionSet element]

     

    my_model GetSelectionSetHandle elem_set $set_id

     

    foreach id 1 {
        elem_set Add 'id $id'
    }

     

    my_query SetSelectionSet $set_id

    my_query SetQuery 'element.id contour.value';

    my_query GetIteratorHandle my_iter

     

    set data_list ''

     

    for {my_iter First} {[my_iter Valid]} {my_iter Next} {
    lappend data_list [my_iter GetDataList]
    }

     

     

    The problem that I run into, that my my_iter First is already causes my_iter Valid to be False, therefore I think something I am doing wrong with the selection of elements. Could you point me in the right direction with the issue? 

    Thank you!

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2019

    I have solved it myself with:

     

    set set_id [my_model AddSelectionSet element];
     my_model GetSelectionSetHandle elem_set $set_id;
     elem_set SetSelectMode 'all'
     elem_set Add all;