How can we get minimum distance from a selected source object to multiple destination objects in a drawing? I have 40000 grid points and 1500 lines. Need to find minimum distance of every grid point with every line.
Give us more information. Are the 40000 grid points in a regular rectangular grid? Are they Point entities, or Blocks, or just locations, or something else? What is the "minimum distance of [a] grid point with [a] line"? Is it the distance from either endpoint of the Line to the nearest grid point [A below]? Or the distance from the nearest grid point to the closest point on the Line [B], if that's not an endpoint? Etc., etc. A [smaller-quantity] image or sample drawing would help.
You could use the ' Project Point onto Line' - Lee Mac,
lee-mac.com/mathematicalfunctions.html,
if you intended to use the 'LINE' data; or use
'vLax-curve-getCLosestPointTo for a bit less code
and more speed.
The grid points are in a rectangular grid. I have to find the minimum distance between grid point and every line.
@Anonymous wrote:
The grid points are in a rectangular grid. I have to find the minimum distance between grid point and every line.
I repeat the remainder of my questions after the first, and add some more:
The grid of points in the image is in a limited area. Do you want to know the distance [whatever that means] from Lines that are outside that area to those grid points shown, or to what would be the nearest grid point in an extension of that grid, or should Lines outside that area be ignored?
By "line," do you mean Line entities, or does a series of end-to-end connected ones constitute one "line" [probably really a Polyline?] and you need to know only one minimum distance from anywhere on it to the nearest grid point?
That's a lot of "lines" [whether individual Lines or Polylines}. What would be the desired format of the information? Text in the drawing? If so, at each Line, or in a Table or block of Mtext, or...? An external file of some kind? List the entity name of a Line plus the distance to the nearest grid point, plus maybe the coordinates of that grid point? Etc., etc.
Can't find what you're looking for? Ask the community or share your knowledge.