BULK_UNSUPPORTED_CARDS & tcl script ?

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

Hi,

With NASTRAN profile, I would like to read/write BULK_UNSUPPORTED_CARDS by using a tcl script. Is this possible?

 

Thanks in advance,

 

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited October 2014

    Yes, it is possible. Here are some snippets to read/write to the BULG_UNSUPPORTED_CARDS. Just a disclaimer, haven't try all the code below.

     

    check that the card exists.


    set cards [ hm_entitylist cards name ]
    set exists [ lsearch $cards 'BULK_UNSUPPORTED_CARDS' ]
    if {$exists != '' } {
        puts stdout 'BULK_UNSUPPORTED_CARDS exists'
    }

    if it does not exists, you need to create it...


    *cardcreate 'BULK_UNSUPPORTED_CARDS'

    To get the names of the cards, see http://www.altairhyperworks.com/(S(3fu2zyrlbyi03xcofiue25jd))/hwhelp/Altair/hw11.0/help/hwd/hwd.htm?control_cards.htm

     

    Get the number of unsupported cards 


    set numOfUnsupportedCards [ hm_getentityvalue cards 'BULK_UNSUPPORTED_CARDS' '\$Bulk_NumUnsupportedCards' 0 ]

    then you loop thru all the lines that the card have


    for { set i 1 } { $i <= $numOfUnsupportedCards } { incr i } {
    set line [ hm_attributearrayvalue cards BULK_UNSUPPORTED_CARDS Bulk_UnsupportedCards $i ]
    # you may want to append to a list;
    }

    to write to the card, you need to tell HM how many unsupported cards you have as an integer attribute update and also, you need to update a string array attribute of the card. It think is as follows


    set bulk_unsupported_id [ hm_getentityvalue cards 'BULK_UNSUPPORTED_CARDS' id 0 -byname ]
    set num_unsupported_lines [ llength $data_list ]
    *attributeupdateint cards $bulk_unsupported_id 4080 1 0 0 $num_unsupported_lines
    eval *createstringarray $num_unsupported_lines $data_list
    *attributeupdatestringarray cards $bulk_unsupported_id 4081 1 2 0 1 $num_unsupported_lines

    the list data_list includes the data you want to add to the unsupported card.

     

    Hope this help. Some time a Altair AE explained me how to edit the cards. Aren't the Altair AE awesome?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited October 2014

    Thank you so much, cesar.rivas !