How to get already created node or element set

Vikas Kumar_22189
Vikas Kumar_22189 Altair Community Member
edited October 2020 in Community Q&A

Dear All,

 

I am using .dat and .op2 file for loading the model in hyperview.

In .dat file we already have created sets for some elements and nodes seperatly.

I want to take node id or element id from that sets. But, by using the label name of set.

I am using tcl/tk for that but not getting.

Please provide any script to find the same.

 

Best Regards,

Vikas Kumar

Answers

  • imoto
    imoto
    Altair Employee
    edited December 2018

    @Vikas Kumar

     

    You can get the ID list with following example,

     

    hwi OpenStack;
    set t [::post::GetT];
    hwi GetSessionHandle sess$t;
    sess$t GetProjectHandle proj$t;
    proj$t GetPageHandle page$t [proj$t GetActivePage];
    page$t GetWindowHandle wind$t [page$t GetActiveWindow];
    wind$t GetClientHandle clie$t;
    clie$t GetModelHandle modl$t [clie$t GetActiveModel];
    foreach sid [modl$t GetSelectionSetList 'Set'] {
     modl$t GetSelectionSetHandle sels${t}_00${sid} $sid;
     set name [sels${t}_00${sid} GetLabel];
     set list [sels${t}_00${sid} GetList];
     puts 'Name = $name , IDs = $list';
    }
    hwi CloseStack;

     

    Thanks,
    Imoto

  • Vikas Kumar_22189
    Vikas Kumar_22189 Altair Community Member
    edited December 2018

    @Vikas Kumar

     

    You can get the ID list with following example,

     

    hwi OpenStack;
    set t [::post::GetT];
    hwi GetSessionHandle sess$t;
    sess$t GetProjectHandle proj$t;
    proj$t GetPageHandle page$t [proj$t GetActivePage];
    page$t GetWindowHandle wind$t [page$t GetActiveWindow];
    wind$t GetClientHandle clie$t;
    clie$t GetModelHandle modl$t [clie$t GetActiveModel];
    foreach sid [modl$t GetSelectionSetList 'Set'] {
     modl$t GetSelectionSetHandle sels${t}_00${sid} $sid;
     set name [sels${t}_00${sid} GetLabel];
     set list [sels${t}_00${sid} GetList];
     puts 'Name = $name , IDs = $list';
    }
    hwi CloseStack;

     

    Thanks,
    Imoto

     

    thansk imoto

     

    i was also using same methodology but, since while exporting model from HM we haven't tick Hypermesh Comments  so tool was not recognizing by label as well as by ID.

    We need to tick below mentioned checkbox while exporting model otherwise it won't recognize

     

    image.png.58cc3c6e1deda00bf64384d4b10e51fa.png

     

     

     

    Thanks @Imoto for your reply.

     

    Best Regards,

    Vikas Kumar

  • imoto
    imoto
    Altair Employee
    edited December 2018

    @Vikas Kumar

     

    Absolutely, because if remove the HyperMesh-Commnet, the solver deck does not contain the any Label and Types.
    Like this-><?xml version="1.0" encoding="UTF-8"?>NastranDeck.jpg


    So, HyperView will create the both sets of Node and Elements with labeled by ID.

    <?xml version="1.0" encoding="UTF-8"?>HV_BrowserSet.jpg

     

    Thanks,

    Imoto

  • Vikas Kumar_22189
    Vikas Kumar_22189 Altair Community Member
    edited December 2018

    @Vikas Kumar

     

    Absolutely, because if remove the HyperMesh-Commnet, the solver deck does not contain the any Label and Types.
    Like this-><?xml version="1.0" encoding="UTF-8"?>NastranDeck.jpg


    So, HyperView will create the both sets of Node and Elements with labeled by ID.

    <?xml version="1.0" encoding="UTF-8"?>HV_BrowserSet.jpg

     

    What happens if duplicate set ID is there. 

    eg.- 

    image.png.d8ae7f2a84e78474130afe6975df2635.png

     

    In this case I have used command 

    set listForAllSet [modl$t GetSelectionSetList]

    This command giving all ID's 

    but for set id  1 it is always returning '0D Set' as label but i want next time it should return 'Front'

    same is happening with id 3,4.

    That's why i want to take element or node id from set by using set name not by using set id. Is it possible.

    I know keeping same id is not good but i need to deal with this.

     

    Best Regards,

    Vikas Kumar

  • Vikas Kumar_22189
    Vikas Kumar_22189 Altair Community Member
    edited December 2018

    @Imoto   Set 1,2,3,4  came along with op2 file so we don't have control over that.

  • imoto
    imoto
    Altair Employee
    edited December 2018

    Hi @Vikas Kumar

     

    In my past posted example is specify the poolname, the poolname is available 'Set' or 'User_Set'.

     

    Please try to get the set list using 2 poolnames.
    modl$t GetSelectionSetList 'User_Set'; = automaticly created sets.
    modl$t GetSelectionSetList 'Set'; = from solver deck.
     

    Thanks,

    Imoto

  • Vikas Kumar_22189
    Vikas Kumar_22189 Altair Community Member
    edited December 2018

    HI @Imoto

     

    Those all are the Set but still not coming.

     

    image.png.2f9b37550e997633afaa620ddcbc1be6.png

     

    Thanks,

    Vikas Kumar

  • imoto
    imoto
    Altair Employee
    edited December 2018

    Hi @Vikas Kumar

     

    Now I guess understood your point, it should be specify the poolname when get the Set handle.

    Like this -> modl$t GetSelectionSetHandle sels${t}_00${sid} 'Set $sid';

     

    --- Correct example ---

    hwi OpenStack;
    set t [::post::GetT];
    hwi GetSessionHandle sess$t;
    sess$t GetProjectHandle proj$t;
    proj$t GetPageHandle page$t [proj$t GetActivePage];
    page$t GetWindowHandle wind$t [page$t GetActiveWindow];
    wind$t GetClientHandle clie$t;
    clie$t GetModelHandle modl$t [clie$t GetActiveModel];
    foreach sid [modl$t GetSelectionSetList 'Set'] {
     modl$t GetSelectionSetHandle sels${t}_00${sid} 'Set $sid';
     set name [sels${t}_00${sid} GetLabel];
     set list [sels${t}_00${sid} GetList];
     puts 'Name = $name , IDs = $list';
    }
    hwi CloseStack;
     

    Thanks,

    Imoto

  • Vikas Kumar_22189
    Vikas Kumar_22189 Altair Community Member
    edited December 2018

    Yes @Imoto .. you have done ... I wanted this only.

     

    thanks,

    Vikas Kumar