hm_measureshortestdistance not working properly


All the brown color elems are 3d elements in the collector solidmap while the green color elems are 2d elems in collector auto1.
I execute the following command
*createmark elems 1 599
*createmark elems 2 'by comp name' auto1
hm_measureshortestdistance elems 1 0 elems 2 0 0
it returns-> 0 0 0 0 599 0 0 0 1 0 0 0
but as we can see the distance between elem id 599 and elem id 1 is not 0.and elem id 1 is not the nearest elem to 599 among all other elems of auto1.
Can somebody explain this ?
How about this:
*createmark nodes 1 'by elem' 599
*createmark nodes 2 'by comp name' auto1
set N2 [lindex [hm_measureshortestdistance nodes 1 0 nodes 2 0 0] end-3]
*createmark elems 1 'by node' $N2
puts 'closest elems: [hm_getmark elems 1]'
You can use hm_entityinfo centroid elems
to get centroid of e599 and the closest elems then compare which one is closer to e599 => decide that is closest.


hello Tinh
hm_measureshortestdistance nodes 1 0 nodes 2 0 0 is giving 'expected integer but got '0 ' error ..


Nopes I didn't copy pasted. I typed myself many times but everytime the same error its giving.


hwat::utils::GetClosestElement first three arguments are x y z coordinates but the last argument is assembly name. This argument is not working if I give the collector name as here 'auto1'
put that collector (comp) in an assembly, and use the assembly name as argument


yes putting that component in a different assembly works. Thanks for the solution . And I tried the hm_measureshortestdistance on a different computer but its giving the same error
I got the ans, elem is not a valid entity type for this type, the Valid values are nodes, points, lines, surfaces and solids.Apart from this is there any api which can do the task which I intend to do ?