🎉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

Select elements from a set of nodes

User: "vipin_22401"
Altair Community Member
Updated by vipin_22401

Hi all,

 

Is there any direct api to select elements from a set of nodes?( For example in the image i need the highlighted elements, dont need the adjacent elements to be selected.)

I tried *findmark and *createmark which are selecting the nearby elements too.

 

 

image.png.3c982e0171fe1c3a97b3ec6b7075d8a0.png

Find more posts tagged with

Sort by:
1 - 6 of 61
    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi Vipin

    You can ignore adjacent elems

    *createmark nodes 1 {*}$NodeList

    *createmark elems 1 'by node' {*}[hm_getmark nodes 1]

    *createmark elems 1 reverse

    *appendmark elems 1 'by adjacent'

    *createmark elems 1 reverse

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

    Another solution you can try is the following:

     hm_createmark nodes 1 'by id only' $NodeList; hm_createmark nodes 1 advanced reverse; hm_createmark elems 1 'by nodes' [hm_getmark nodes 1]; hm_getmark elems 1;

     

    User: "vipin_22401"
    Altair Community Member
    OP
    Updated by vipin_22401

    Nice trick @tinh, @akitoguc :D/emoticons/default_biggrin.png' srcset='/emoticons/biggrin@2x.png 2x' title=':D' width='20' />

    Works for me!

     

    User: "Roshan Shiveshwar"
    Altair Community Member
    Updated by Roshan Shiveshwar

    Just another way to handle this....

     

    *createmarkpanel nodes 1 'Select nodes to which the attached elements have to be determined'
    eval '*createmark elems 1 \'by nodes\' [hm_getmark nodes 1]'
    eval '*createmark nodes 2 \'by elems\' [hm_getmark elems 1]'
    *marknotintersection nodes 1 nodes 2
    eval '*createmark elems 2 \'by nodes\' [hm_getmark nodes 1]'
    *markdifference elems 1 elems 2
    set attached_elem_list [hm_getmark elems 1]

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Oh, many ways...

    @vipin should test which one is the fastest

    Using cmd

    time {script}

    To measure time to finish a script

    User: "vipin_22401"
    Altair Community Member
    OP
    Updated by vipin_22401

    @tinh

    Tested all methods, last one runs faster on bigger assemblies (saves around 5 sec ;)/emoticons/default_wink.png' srcset='/emoticons/wink@2x.png 2x' title=';)' width='20' /> ).

    Thanks again all!