🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

hm_measureshortestdistance not working properly

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

                    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 ?

<?xml version="1.0" encoding="UTF-8"?>image.png

Find more posts tagged with

Sort by:
1 - 9 of 91
    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    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 ?

    User: "tinh"
    Altair Community Member
    Updated by tinh

    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.

     

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    hello Tinh 

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

    User: "tinh"
    Altair Community Member
    Updated by tinh

    maybe, you copy & paste my code. Be not lazy, pls type it again, man!

    User: "tinh"
    Altair Community Member
    Updated by tinh

    a relevant command you should refer:

    hwat::utils::GetClosestElement

    in package hwat

     

    Refer HW Help Home> Hyperworks Tools > Hyperworks Automation Toolkit

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

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

     

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User
    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'
    User: "tinh"
    Altair Community Member
    Updated by tinh
    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

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    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