"hm_getdistance nodes" refere to single values

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hello at all,

 

My Problem:

  • have got two nodes (node 1 and node 2)          --> node 1 is the reference for current position; node 2 is the reference for target position
  • when using hm_getdistance nodes 1 2 0 ,

i get the following answer:

573.68267674323      495.66721    3.8981341703782e-014       288.8353

total distance              x-distance     y-distance                             z-distance

 

I´ll put the values for total distance and x-, y-, z-distances in a subsequent command for translate a hole component from node1 to node 2.

Therefore i need to create a vector with

*createvector 1 $x $y $z

*translatemark components 1 1 $total_distance 1

 

How can i get access or refer to the single values?

 

Thanks for your help :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

 

 

My latest try:

 *createmark components 1 'displayed' # *createmarkpanel nodes 1 'choose node 1' *createmark nodes 1 # *createmarkpanel nodes 2 'choose node 2' *createmark nodes 2 # set xVal [hm_getdistance nodes 1 2 dataname=x] set yVal [hm_getdistance nodes 1 2 dataname=y] set zVal [hm_getdistance nodes 1 2 dataname=z] set totVal [hm_getdistance nodes 1 2 dataname=tot] # *createvector 1 $xVal $yVal $zVal *translatemark components 1 1 $totVal

the problem is the 'dataname='

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2016

    Hi Rizzo,

     

    You can do this using foreach:

     *createmark components 1 'displayed' *createmarkpanel nodes 1 'node1' set node1 [hm_getmark nodes 1] *clearmark nodes 1  *createmarkpanel nodes 1 'node2' set node2 [hm_getmark nodes 1] *clearmark nodes 1  foreach {tot x y z} [hm_getdistance nodes $node1 $node2 0] {  	*createvector 1 $x $y $z 	*translatemark components 1 1 $tot }

    Regards,

    Matt