need your help: extract Ids from elements

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

dear for all

i need to extract nodes from several comp like green elements in ordered way:

the idea is to extract nodes from begin 1 to end 1 and from begin 2 to end 2 separately

i used  [hm_getvalue comps id=$compid dataname=nodes.id] --> no ordred Ids 

any propositions?

thx

<?xml version="1.0" encoding="UTF-8"?>image.thumb.png.b00907d11e62893bc5c1c5344f16298b.png

Answers

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited January 2018

    I don't if there's a function to do that quickly.

    If not, you can build a ordered list yourself with Tcl.

  • tinh
    tinh Altair Community Member
    edited February 2018

    I guess, if hm generates free edges, it will create them ordered

    so try:

    *createmark elems 1 'by comp id' $compid

    *findloops elems 1

    *createmark elems 1 'by comp name' ^loops

    set OrderedNodes [hm_getmarkvalue elems 1 nodes 0]

    puts $OrderedNodes

  • tinh
    tinh Altair Community Member
    edited February 2018

    From version 2017 please try this command:

    hm_formnodelistsfrommark

     

    Or command:

    hm_getedgeloops

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited February 2018

    thank you for your reply,

    for the first post: it is equivalent to: hm_getvalue comps id=$compid dataname=nodes.id

    for the second we use version 13 or 14

    i'm trying with  *markintersection

  • tinh
    tinh Altair Community Member
    edited February 2018

    'for the first post: it is equivalent to: hm_getvalue comps id=$compid dataname=nodes.id'

     

    Are them output ordered?

    As I tested, they are.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited February 2018

    yes they are but not as we wish :

    in this capture below we show how we want extract ids in two different lines

    thx

     

    <?xml version="1.0" encoding="UTF-8"?>image.thumb.png.1be4388c19d2b5c415db76eabc844fcb.pngin this

     

  • tinh
    tinh Altair Community Member
    edited February 2018

    you can extract them by 

    set index1 [lsearch $nodelist 353389]

    set index2 [lsearch $nodelist 352605]

    set ligne1 [lrange $nodelist $index1 $index2]

    set index3 [lsearch $nodelist 364500]

    set index4 [lsearch $nodelist 364593]

    set ligne2 [lrange $nodelist $index3 $index4]