osnap
(osnap point esnap_mode)
The osnap function returns a 3D point as a result of applying entity snap mode(s) specified by the mode argument nearest to the specified point.
Arguments
esnap_mode specifies one or more entity snap modes as a text string containing one or more keywords. Multiple keywords are separated by commas.
Supported values are: 
  
    | Keyword | Entity Snap Mode | 
  
    | _endp | End point | 
  
    | _mid | Mid point | 
  
    | _int | Intersection | 
  
    | _appimt | Visual intersection | 
  
    | _ext | Extension | 
  
    | _cen | Center point | 
  
    | _qua | Quadrant | 
  
    | _tan | Tangent | 
  
    | _ins | Insertion point | 
  
    | _nod | Node (point entity) | 
  
    | _par | Parallel | 
  
    | _per | Perpendicular | 
  
    | _nea | Nearest point on entity | 
Note: Use (setvar "SELECTBOX" size) to define the size of a box in pixels for entity selection.
: (setq x (osnap '(1 1) "_endp"))
(1.0 1.000 0.000)
: (setq x (osnap '(50 50) "_cen,_int"))
(50.000 50.000 0.000)