🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

Help us to write a script to collect elements in set!

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

Hi Guys!

 

I would like to model welds and collect elements from different component to a set, but I have to many components which are connected, therefore this process is fairly slow.  I don't have any experience in scripting, but a script could accelerate my work. You can see below one example for this problem. 3 hollow section encounter at the same place and I need to collect the elements to a set from the common edges as you can see at the pictures below. I need to collect elements to sets whose nodes belong to different components. If you could write a script or give me some useful advise I will be very grateful.
Thank you for your help in advance!

 

Best regards,
Tüki

<?xml version="1.0" encoding="UTF-8"?>Capture1.PNG

<?xml version="1.0" encoding="UTF-8"?>Capture.PNG

Find more posts tagged with

Sort by:
1 - 12 of 121
    User: "QuyNguyenDai"
    Altair Community Member
    Updated by QuyNguyenDai

    There are several methods to do that. I can imagine a simple method:

    • Make a node set for each component
    • Look for intersection (nodes) between sets
    • From intersection nodes, look for elements which share these nodes

    HTH,

     

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Thanks for your fast answers! Your method sound logic to me, but there is a problem. There are more than 300 components in my model, so creating sets for each is very slow. (giving property to each component was fun too...). I've just started to use Altair HyperMesh a month ago, so I'm a rookie. I can make node sets for each component, but I don't know how can I check for intersection nodes between sets. Then there is another problem: how can I collect elements to a sets that belong to the intersection nodes?

    Sorry for incomprehension, as I mentioned I'm new with this program.

     

    Thanks for your answer in advance!

     

    Best regards,

    Tüki

    User: "QuyNguyenDai"
    Altair Community Member
    Updated by QuyNguyenDai

    If you can share a simple model (with some component only) so I can do the test?

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi, is it a 2D model?

    if it is a 3d, then it's not simple

    let me try ... tomorrow -_-/emoticons/default_sleep.png' srcset='/emoticons/sleep@2x.png 2x' title='-_-' width='20' />

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Yes, I can. You can see some hollow section in this model, it's just 6 components.
    Thanks for your help! :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

    Tüki

    Unable to find an attachment - read this blog

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Hi, is it a 2D model?

    if it is a 3d, then it's not simple

    let me try ... tomorrow -_-/emoticons/default_sleep.png' srcset='/emoticons/sleep@2x.png 2x' title='-_-' width='20' />

    Hi tinh!

    It's a 3D model, but I use shell mesh, so there aren't 3D elements.

    User: "tinh"
    Altair Community Member
    Updated by tinh

    It sounds good. could you try

    - shiftF3 select elems, switch 'find edges' to 'find t-con' then click button 'find edges'

    - shiftF5 turn to 'find attached', select 'find elems ... attach to elems'

    select elems>by collector > ^edges > find > save found

    - now enter entity set panel and create your set of elems > retrieve

    then delete the t-connection

    User: "QuyNguyenDai"
    Altair Community Member
    Updated by QuyNguyenDai

    Here's the TCL script, based on tinh's ideas:

      *createmark elements 1 'displayed' *findedges1 elements 1 1 0 0 30 hm_createmark elems 1 'by comp name' '^edges' *findmark elems 1 257 1 elements 0 2 *entitysetcreate 'E_T' elements 2 *clearmark elems 1 *clearmark elems 2 *clearmark sets 1  *createmark comps 1 'displayed'  foreach i [hm_getmark comps 1] { set cname [hm_entityinfo name components $i] if {$cname == '^edges'} { continue } set set_name 'E_$cname' hm_createmark elems 1 'by set name' 'E_T' hm_createmark elems 2 'by comp id' $i *markintersection elems 1 elems 2 eval *entitysetcreate '$set_name' elems 1 } *clearmark elems 1 *clearmark elems 2

    My script will also create one element Set for each component.

    <?xml version="1.0" encoding="UTF-8"?>T-con2set.png

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Thanks for the answers!
    If I want to collect all these element into 1 set what should I do then?

    User: "QuyNguyenDai"
    Altair Community Member
    Updated by QuyNguyenDai

    Already created by my script within the set 'E_T'

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Already created by my script within the set 'E_T'

    Thanks! I'm home because of Easter, so I could not check the script yet.

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Guys, I found another solution after I scrutinized your method. So here is my method in some easy steps:

    1. Tool page > find > between > find nodes between comps > find > save found
    2. Create > set > change card image to SET_GRID > select nodes > retrieve > proceed
    3. Tool page > find > find attached > find elems attached to nodes > by sets (by grid set you've just created before) > find > save found
    4. Create  > set  > elems > retrieve > proceed

    This method find all of the elements if the grids of your mesh are equivalenced.

    Thanks for help again!

    Best regards,

    Tüki