Jump to content

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

Recommended Posts

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.

Share this post

Link to post
Share on other sites


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


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...