Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Minimum distance between grid points and multiple objects

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
1134 Views, 4 Replies

Minimum distance between grid points and multiple objects

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. 

4 REPLIES 4
Message 2 of 5
Kent1Cooper
in reply to: Anonymous

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.

 

PointLine.PNG

 

Kent Cooper, AIA
Message 3 of 5
stevor
in reply to: Anonymous

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.

 

 

S
Message 4 of 5
Anonymous
in reply to: Kent1Cooper

The grid points are in a rectangular grid. I have to find the minimum distance between grid point and every line.

Message 5 of 5
Kent1Cooper
in reply to: Anonymous


@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.

Kent Cooper, AIA

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report