Hyperview - Get list of components and ids

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

Hello! I am a new to TCL scripting to work with Hyperworks tools. I need a TCL script for Hyperview that will read and write all the component names and their respective ids. Writing it to the clipboard for pasting or writing to a csv/excel file would be most helpful.

 

Thanks ahead of time!

Answers

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited November 2018

    Hi,

    It's fairly direct. 

     hwi OpenStack hwi GetSessionHandle session1 session1 GetProjectHandle project1 project1 GetPageHandle page1 1 page1 GetWindowHandle win1 1 win1 GetClientHandle anim anim GetModelHandle my_model [anim GetActiveModel] my_model GetQueryCtrlHandle my_query set set_id [my_model AddSelectionSet component] my_model GetSelectionSetHandle comp_set $set_id # Select all Components comp_set Add 'All' my_query SetSelectionSet $set_id # ask for ids and component name my_query SetQuery 'component.id component.name' my_query WriteData D:/out.csv # clean up my_model RemoveSelectionSet $set_id hwi CloseStack

     

  • Sagar Motwani_20540
    Sagar Motwani_20540 Altair Community Member
    edited April 2019

    Can some would suggest me script for read and write all the subcase names and their respective ids, for now to get all subcases names, I am using-

    hwi GetSessionHandle mySessionName

    mySessionName GetDataFileHandle myDataFile $op2File
        
    set subcase_list [myDataFile GetSubcaseList] 
    puts 'subcase_list $subcase_list'

     

    can some suggest script or code to find all Subcases ids with minimal changes in above.

  • llyle_20499
    llyle_20499 New Altair Community Member
    edited October 2020
    https://community.altair.com/community?id=community_question&sys_id=10664cf61b2bd0908017dc61ec4bcbef

    For subcase names, pass result_handle GetSubcaseLabel $n_subcaseID