Jump to content
rk2

hm_measureshortestdistance not working properly

Recommended Posts

                    image.png.aabafc49bd9f6f99cb524bdc5e2f1f30.png                            image.png.1e3de18edb803d25e6c85801c529c879.png

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 ?

image.png

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

hello Tinh 

hm_measureshortestdistance nodes 1 0 nodes 2 0 0 is giving "expected integer but got "0 " error ..

Share this post


Link to post
Share on other sites

a relevant command you should refer:

hwat::utils::GetClosestElement

in package hwat

 

Refer HW Help Home> Hyperworks Tools > Hyperworks Automation Toolkit

rk2 likes this

Share this post


Link to post
Share on other sites
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"

Share this post


Link to post
Share on other sites
7 minutes ago, rk2 said:
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

Share this post


Link to post
Share on other sites

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 

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.

Guest
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...