hm_getnearestsectionid

Find the closest sub-section ID of 2D parameterized points.

Syntax

hm_getnearestsectionid u_coords v_coords id_joints u_coord v_coord tol

Type

HyperWorks Tcl Query

Description

This command returns the closest sub-section ID to the point (u_coord, v_coord) with a tolerance tol. The sub-section is a part of 2D points (u_coords, v_coords), that are parameterized (id_joints). These 2D points can be collected into consecutive arcs and segments (sub-sections). The connection points between the arcs and the segments are called joints (id_joints) and are identified with the ID of the corresponding 2D points (u_coords, v_coords). The command returns the ID of the sub-section closest to (u_coord, v_coord).

If no sub-section is found the command returns -1.

Example

To get the sub-section ID closest to the point (u_coord,v_coord) with tolerance tol, it is necessary to define the list of u points coordinates, v points coordinates and the joint list of 2D points.

set u_coords [list 0.000000 10.392347 10.813383 17.202622 24.935694 41.768186 43.416489 45.231366 59.304214 96.013871 106.692101 116.565247 127.434528 136.154331 155.640314 155.976209 173.756870 186.665112 190.385532 198.398064 205.466583 206.705139 211.940465 212.902738 214.925971 222.756167]
set v_coords [list 0.000000 -19.538767 -42.080721 -55.501533 -66.433329 -70.784507 -71.152272 -71.668626 -74.730927 -88.150434 -90.409716 -92.065159 -92.278973 -91.618405 -88.070750 -87.960565 -80.568073 -73.279716 -72.144432 -68.037374 -63.790768 -60.550803 -47.918200 -4.991139 -3.147394 4.329084]
set id_joints [list 0 2 4 9 16 20 22 23 25]
set u_coord 74.4300420642
set v_coord -88.3325618848  
set tol  3.85953475146
set section_id [hm_getnearestsectionid $u_coords $v_coords $id_joints $u_coord $v_coord $tol]

Errors

A negative value is returned if no section is found.
if { $section_id <0} { 
#Handle error here //Can't find sub-section closest to the given point.
}