How to get nearest node of other component with the help of temp node from component 1?

User: "Bhavik Sheth_21143"
Altair Community Member
Updated by Bhavik Sheth_21143

Hello Team,

I am new into customization of Hypermesh.

I have one question which I tried to explain in attached image.

Question: I have a list of nodes with ids and co-ordinates from Component 1 and I want to find the nearest node from Component 2 to that respective node from Comp 1. How to do achieve that?

 

Any help will be great.

Thank you in advance.

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Ben Buchanan"
    Altair Employee
    Accepted Answer
    Updated by Ben Buchanan

    Hi Ben,

    Thanks for the suggestion.

    I have used below method. Is that ok?

    set refNodeCoord [hm_getvalue nodes id=[lindex $TempNodesList_1 0] dataname=coordinates]
            puts $refNodeCoord
            
            hm_markclear comps 2
            hm_markclear elems 2
             
            hm_createmark comps 2 $Comp2_Name
            hm_createmark elems 2 "by comps on mark" 2
            
            set refCloseNode [hm_getclosestnode [lindex $refNodeCoord 0] [lindex $refNodeCoord 1] [lindex $refNodeCoord 2] 2]
            #Get ID of Last created Node
            set pnt [TheLast node]
             
             set ref2Pnt [hm_getvalue nodes id=$pnt dataname=coordinates]
             puts $ref2Pnt
            
             hm_markclear comps 2
             hm_markclear elems 2

    I would make the following changes:

       set refNodeCoord [hm_getvalue nodes id=[lindex $TempNodesList_1 0] dataname=coordinates]
            puts $refNodeCoord
            
            *clearmarkall 2
             
            hm_createmark comps 2 $Comp2_Name
            hm_createmark elems 2 "by comps on mark" 2
            
            set refCloseNode [hm_getclosestnode {*}$refNodeCoord 2]
             
             set ref2Pnt [hm_getvalue nodes id=$refCloseNode dataname=coordinates]
             puts $ref2Pnt
            
             *clearmarkall 2