How to get nearest node of other component with the help of temp node from component 1?
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.
Best Answer
-
Bhavik Sheth_21143 said:
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 2I 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 21
Answers
-
The hm_getclosestnode should get you what you want if you pick elements by component.
https://help.altair.com/hwdesktop/hwd/topics/reference/hm/hm_getclosestnode.htm0 -
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 20 -
Bhavik Sheth_21143 said:
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 2I 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 21 -
Thank you so much for the guidance.
It works as required.
0