How yo retrive node id from a particular selected node in Python Hypermesh 2024

amit_gudi
amit_gudi Altair Community Member
edited November 21 in Community Q&A

In my script, I need to position components and require a node ID from a collection. The output from the collection is of type hwreturnstatus. How can I retrieve the node ID from this output? Alternatively, is there a different method available to fetch the node ID?

Answers

  • Hello @amit_gudi ,

    there are 2 ways of proceeding:

    you can grab a single entity from the collection and ask for the ID:

    list(col)[0].id

     

    or turn a collection into a list of IDs:

    [e.id for e in col]

    Hope that helps,

    Michael