🎉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

How to get ID of line closest to the given node using tcl?

User: "Vladimir Gantovnik_21974"
Altair Community Member
Updated by Vladimir Gantovnik_21974

Guys, how to get ID of line closest to the given node? Actually, I need to get IDs of 4 closest lines like in the situation shown in the figure below. I thought that I could create centroids of all possible lines, then find centroids that are closest to the given node, and then identify line IDs. But there is no function to get centroid of line. Thank you!

image

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Adriano_Koga"
    Altair Employee
    Accepted Answer
    Updated by Adriano_Koga

    how about this API?

    It would give you the distance and the line ID, but you need to give a list of lines as inoput.

    hm_getdistancefromnearestline

    Gets the distance of the given point from the nearest line with IDs specified as arguments.

    Syntax

    hm_getdistancefromnearestline point_xyz line_id_list

    Type

    HyperMesh Tcl Query Command

    Description

    Gets the distance of the given point from the nearest line with IDs specified as arguments.

    Inputs

    point_xyz
    The list of x, y, z coordinates of the point.
    line_id_list
    List of line IDs.

    Examples

    The function returns a list consisting of two values. The first value is the distance to the closest line. The second value is ID of the closest line.

    To get closest to the point with coordinates (10, 20, 30) point on the line with ID 13:

    hm_getdistancefromnearestline [list 10 20 30] 13

    To get closest line from the set with IDs 13 14 15:

    hm_getdistancefromnearestline [list 10 20 30] [list 13 14 15]

    To get closest to the node with ID 2 point on the line with ID 13:

    hm_getdistancefromnearestline [hm_getvalue nodes id=2 dataname=coordinates] 13