How to get all node coordinates that belongs to one specific component?

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

There are 3 components, compA, compB and compC, in my model. My final goal is to find ten nodes that belongs to compA, which have the smallest distance from origin(0,0,0).

Also, I want this procedure to be automatically done by tcl script.

 

So, the steps I might take is like:

1. Get all node coordinate that belongs to compA.  

 --> I don't know how to get those information. I have try  some command like hm_entitylist, hm_getentityvalue, but in vain. Not sure which command can work.

 

2. Calculate the distances between every nodes and origin(0,0,0).

3. Sort the distances from small to large, and get the smallest 10 nodes' id.

--> I can do these two steps in Matlab, but not sure it will work in Tcl script.

Find more posts tagged with

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

    Hi

    You can do like this

    *createmark elems 1 'by comp name' compA

    *clearmark nodes 1

    for {set i 1} {$i<=10} { incr i} {

         set nodeID [hm_getclosestnode 0 0 0 1 1]

         puts 'node$i\t$nodeID'

         *appendmark nodes 1 $nodeID

    }