poIQueryIterator GetDataList--> Need to get the Component ID

Emil George
Emil George Altair Community Member
edited October 2020 in Community Q&A

Hi..

I am trying to create a TCL script for postprocessing in Hyperview.

I need to get the component ID for the corresponding Node ID which Is showing maximum displacement . I am able to retrieve the node Id and maximum displacement value, but could not retrieve the corresponding component ID.

 

Thanks in advance

Tagged:

Answers

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited April 2018

    Hi Emil, 

    Could you please share the command you're using to query node ID and Maximum displacement. 

  • Emil George
    Emil George Altair Community Member
    edited April 2018

    hi..

    below is the kind of commands I have used.  I am able to get the maximum displacement value and node ID .. But I am not able to get the parent Component ID for the corresponding Node

     

     image.png.0357304af47e6eed1d4f855905c85860.png

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited April 2018

    Hi Emil, 

    You can query component.id too, so: 

     

    qry$w SetQuery 'component.id contour.value';

    qry$w GetIteratorHandle itr$w

     

    For more info please refer:

    https://connect.altair.com/CP/kb-view.html?kb=86070

  • Emil George
    Emil George Altair Community Member
    edited April 2018

    Hi Livil,

    Thanks a lot for your reply..I tried to use the above command and retrieve the component ID to print it in a 'Note Handle'. But I am getting some error. below is the part of the script I have used.

     ######################################################  

        set msr_max [lindex [m1$w GetEntityList] 1]
        qry$w SetQuery 'component.id contour.value'
        qry$w SetSelectionSet [s1$w GetID]
        qry$w GetIteratorHandle itr$w;
        set datalist [itr$w GetDataList];
        itr$w Next
        set componentid [lindex $datalist 0]
        puts $componentid
        puts 'check query'
        set note_id [client$w AddNote]
        set n_handle [client$w GetNoteHandle n$w $note_id]
        n$w SetAttachment 'node $msr_max'
        puts $msr_max
        n$w SetPosition 1 1
        n$w SetBorderThickness 2
        n$w SetLabel 'Max Contour value'
        n$w SetText 'NodeID {entity.id} \nContour_Value {entity.contour_val} \n {entity.component_id}'

    .#############################################################################

  • Emil George
    Emil George Altair Community Member
    edited April 2018

    I need to get get the component ID and make that specific component alone in OPAQUE mode and remaining all parts in transparent view..

     

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited April 2018

    Could you please run it line by line and share the error and the line in which it occurs. 

  • Emil George
    Emil George Altair Community Member
    edited April 2018

    The script is not showing any error as such and is completing .. but I am not getting the desired output below isthe explanation happening at line#8 and line #17

     

    ######################################################  

    1.    set msr_max [lindex [m1$w GetEntityList] 1]
    2.    qry$w SetQuery 'component.id contour.value'
    3.    qry$w SetSelectionSet [s1$w GetID]
    4.    qry$w GetIteratorHandle itr$w;
    5.    set datalist [itr$w GetDataList];
    6.    itr$w Next
    7.    set componentid [lindex $datalist 0]
    8.    puts $componentid                      ---------------->#### Nothing is getting pritted in this line##
    9.    puts 'check query'
    10.    set note_id [client$w AddNote]
    11.    set n_handle [client$w GetNoteHandle n$w $note_id]
    12.    n$w SetAttachment 'node $msr_max'
    13.    puts $msr_max
    14.    n$w SetPosition 1 1
    15.    n$w SetBorderThickness 2
    16.    n$w SetLabel 'Max Contour value'
    17.    n$w SetText 'NodeID {entity.id} \nContour_Value {entity.contour_val} \n {entity.component_id}'  -------->## in the note handle it is Printed like' unknown symbol' entity.componet_id''

    .#############################################################################

    image.png.24bba5b211cbac687df065816d7f9ca9.png

  • Emil George
    Emil George Altair Community Member
    edited April 2018

    Hi Livil,

     

    Is the above info you were asking for?

     

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited April 2018

    Hi, 

    Try following this order

    1.    set msr_max [lindex [m1$w GetEntityList] 1]
    2.    qry$w SetQuery 'component.id contour.value'
    3.    qry$w SetSelectionSet [s1$w GetID]
    4.    qry$w GetIteratorHandle itr$w;

    5.    while {[itr$w Valid]} {

    6.    set datalist [itr$w GetDataList];

    7.    set componentid [lindex $datalist 0]

    8.    puts $componentid 

    9.    itr$w Next

    10.  }


     

  • Emil George
    Emil George Altair Community Member
    edited April 2018

    Thanks for the reply.. I tried what you have shared.. still it is not working

    the script is skipping the above while loop and completing .. not sure where it is going wrong

  • Emil George
    Emil George Altair Community Member
    edited April 2018

    Also one more help I need.. If I know a particular component ID, and I need to keep that alone in Opaque mode and remaining all components in TRANSPARENT mode..

    I tried to refer poIRenderOptions, but could not find any specific command for this

     

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited April 2018

    try these. 

    poIModel_handle SetPolygonMode Transparent

    poIModel_handle SetPolygonMode 'opaque'

     

  • Emil George
    Emil George Altair Community Member
    edited April 2018

    thanks Livil.. It worked