Finding surfaces and elements nearest to temporary nodes.

Rachit Semalty
Rachit Semalty Altair Community Member
edited May 2021 in Community Q&A

Hi all, I want to know if there is a way to associate nodes to nearest surfaces or elements within 3 mm from them using TCl code? Nodes may be attached to different surfaces or elements of different components. We don't know surface or element id initially. Also, is there any way to find out ids of surfaces and elements within 3mm from a node? hm_getnearbyentity does not seem to work properly when I tried to find nearest elements from nodes using sphere and box as well. It requires at least one node of element to be within the sphere and the resulting sphere is very big then. By box method is not working properly too.

Regards,

Rachit

Tagged:

Best Answer

  • Adriano_Koga
    Adriano_Koga
    Altair Employee
    edited May 2021 Answer ✓

    i think "by box" does not apply to surfaces.

    What about this command here?

    If your provide the coordinate of your temp node, and a list of all surfs, it should give you the id of the closest surface.

    hm_getcoordinatesfromnearestsurface

    Finds coordinates of a point that belongs to one of surfaces in input set and is a closest point to the location specified in command input.

    Syntax

    hm_getcoordinatesfromnearestsurface x y z surf_id_list

    Type

    HyperMesh Tcl Query Command

    Description

    This command finds the point on one of surfaces (specified by the list of surface IDs surf_id_list) closest to the point specified by coordinates x, y, z. The command returns the result as a list of four values. The first, second and third value in the list specify the x, y and z coordinates of the closest point correspondingly. The fourth value in the list is the ID of the surface on which the closest point is found.

    Inputs

    x
    The x coordinate.
    y
    The y coordinate.
    z
    The z coordinate.
    surf_id_list
    The ID of the surface on which the closest point is found.

    Example

    To find coordinates of the point on surface 12 that is closest to the location specified by x=1, y=3, z=5:

    hm_getcoordinatesfromnearestsurface 1 3 5 12

    On surfaces with IDs 12, 14, 15 find the point closest to global origin point (x=0, y=0, z=0):

    hm_getcoordinatesfromnearestsurface 0 0 0 [ list 12 14 15 ]

    To create node on surface with ID 10, closest to the point specified by x=1, y=3, z=5:

    set closest_pnt [ hm_getcoordinatesfromnearestsurface 1 3 5 10 ] set x [ lindex $closest_pnt 0 ] set y [ lindex $closest_pnt 1 ] set z [ lindex $closest_pnt 2 ] *createnode $x $y $z

Answers

  • Adriano_Koga
    Adriano_Koga
    Altair Employee
    edited May 2021 Answer ✓

    i think "by box" does not apply to surfaces.

    What about this command here?

    If your provide the coordinate of your temp node, and a list of all surfs, it should give you the id of the closest surface.

    hm_getcoordinatesfromnearestsurface

    Finds coordinates of a point that belongs to one of surfaces in input set and is a closest point to the location specified in command input.

    Syntax

    hm_getcoordinatesfromnearestsurface x y z surf_id_list

    Type

    HyperMesh Tcl Query Command

    Description

    This command finds the point on one of surfaces (specified by the list of surface IDs surf_id_list) closest to the point specified by coordinates x, y, z. The command returns the result as a list of four values. The first, second and third value in the list specify the x, y and z coordinates of the closest point correspondingly. The fourth value in the list is the ID of the surface on which the closest point is found.

    Inputs

    x
    The x coordinate.
    y
    The y coordinate.
    z
    The z coordinate.
    surf_id_list
    The ID of the surface on which the closest point is found.

    Example

    To find coordinates of the point on surface 12 that is closest to the location specified by x=1, y=3, z=5:

    hm_getcoordinatesfromnearestsurface 1 3 5 12

    On surfaces with IDs 12, 14, 15 find the point closest to global origin point (x=0, y=0, z=0):

    hm_getcoordinatesfromnearestsurface 0 0 0 [ list 12 14 15 ]

    To create node on surface with ID 10, closest to the point specified by x=1, y=3, z=5:

    set closest_pnt [ hm_getcoordinatesfromnearestsurface 1 3 5 10 ] set x [ lindex $closest_pnt 0 ] set y [ lindex $closest_pnt 1 ] set z [ lindex $closest_pnt 2 ] *createnode $x $y $z
  • Rachit Semalty
    Rachit Semalty Altair Community Member
    edited May 2021

    i think "by box" does not apply to surfaces.

    What about this command here?

    If your provide the coordinate of your temp node, and a list of all surfs, it should give you the id of the closest surface.

    hm_getcoordinatesfromnearestsurface

    Finds coordinates of a point that belongs to one of surfaces in input set and is a closest point to the location specified in command input.

    Syntax

    hm_getcoordinatesfromnearestsurface x y z surf_id_list

    Type

    HyperMesh Tcl Query Command

    Description

    This command finds the point on one of surfaces (specified by the list of surface IDs surf_id_list) closest to the point specified by coordinates x, y, z. The command returns the result as a list of four values. The first, second and third value in the list specify the x, y and z coordinates of the closest point correspondingly. The fourth value in the list is the ID of the surface on which the closest point is found.

    Inputs

    x
    The x coordinate.
    y
    The y coordinate.
    z
    The z coordinate.
    surf_id_list
    The ID of the surface on which the closest point is found.

    Example

    To find coordinates of the point on surface 12 that is closest to the location specified by x=1, y=3, z=5:

    hm_getcoordinatesfromnearestsurface 1 3 5 12

    On surfaces with IDs 12, 14, 15 find the point closest to global origin point (x=0, y=0, z=0):

    hm_getcoordinatesfromnearestsurface 0 0 0 [ list 12 14 15 ]

    To create node on surface with ID 10, closest to the point specified by x=1, y=3, z=5:

    set closest_pnt [ hm_getcoordinatesfromnearestsurface 1 3 5 10 ] set x [ lindex $closest_pnt 0 ] set y [ lindex $closest_pnt 1 ] set z [ lindex $closest_pnt 2 ] *createnode $x $y $z

    Dear @Adriano A. Koga, thanks for your reply. Yes hm_getnearestentity does not find surfaces. It does find elements but that does not seem to work properly as at least one node of the element must be within the search sphere and not just the element's face or edges. Searching using the box method instead of the sphere gives illogical results.

    The command you are telling can work but I will also need to find the distance between the temp node and closest node on a surface to ensure that they are within 3mm. It is good but actually, I was looking for something that may be quicker than this as I have a number of nodes with me.

    I got the nodes where free lines intersect surfaces. If hypermesh may find where free lines intersect surfaces, why cannot it associate the node to the same surface (closest to the node) the line has intersected? Is there any way I way do that? I want to do that just to find out the ID of the surfaces within 3mm from another surface. I hope you understand.

    Still this command works good for me. The whole process becomes lengthy but at least it is working. Thanks again for your reply.

    Regards,

    Rachit