rog1n Posted October 7, 2019 Posted October 7, 2019 Hello, I have a polyline with many vertices, I can find the closest point [red X] of this polyline with other point [blue X] with vlax-curve-getClosestPointTo as the image bellow, but how I find the two vertices [red circles] that represent the line segment of the red X? Quote
dlanorh Posted October 7, 2019 Posted October 7, 2019 (edited) Use (setq p_param (vlax-curve-getparamatpoint ent (red cross coords))) this will return the polyline parameter at that point (each vertex is a whole number parameter) Then (setq pre_param (fix p_param) ;the parameter of the vertex before post-param (1+ pre_param) ;the vertex after pre_vtx (vlax-curve-getpointatparam ent pre_param) ;gets the coords of the vertex before post_vtx (vlax-curve-getpointatparam ent post_param) ;the coords of the vertex after ) Edited October 7, 2019 by dlanorh 1 Quote
dlanorh Posted October 7, 2019 Posted October 7, 2019 No problem. You could run them together, but you start to lose readability (setq p_param (vlax-curve-getparamatpoint ent closest-pt-on-pline )) (setq pre_vtx (vlax-curve-getpointatparam ent (fix p_param)) ;gets the coords of the vertex before post_vtx (vlax-curve-getpointatparam ent (1+ (fix p_param))) ;the coords of the vertex after ) Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.