Python script for renumbering the elements and Nodes

Unknown
edited August 6 in Community Q&A

Hello  i wanted to create a script for renumbering the elements and node id in python for hypermesh 2024 .

can i get a script related to that.

Answers

  • SunnyZhang
    SunnyZhang
    Altair Employee
    edited August 2

    import hm

    import hm.entities as ent

    elems = hm.Collection(model,ent.Element)

    model.renumbersolverid(collection=elems,start_id=1,incr_val=1,offset_val=1,offset_flag=0,reserved_1=0,reserved_2=0,reserved_3=0)

    nodes = hm.Collection(model,ent.Node)

    model.renumbersolverid(collection=nodes,start_id=100,incr_val=1,offset_val=1,offset_flag=0,reserved_1=0,reserved_2=0,reserved_3=0)

  • Unknown
    edited August 5

    Thank you for the reply Shayan Zhang. If i need to renumber the specific collector elements how can i do it.

     

  • SunnyZhang
    SunnyZhang
    Altair Employee
    edited August 6

    Thank you for the reply Shayan Zhang. If i need to renumber the specific collector elements how can i do it.

     

    You are welcome Saravanan.

    For that purpose, you just need to change the collection instantiation to collect specific elems. 

    For how to, you can check out the links below and their contexts:

    https://help.altair.com/hwdesktop/pythonapi/hypermesh/hm.html#filterbyenumeration-class

    https://help.altair.com/hwdesktop/pythonapi/hypermesh/hm.html#collection-class

    Hope you enjoy the Hypermesh Python API learning journey! 

    Shaoyan