Geometric Utilities

AutoCAD AutoLISP & Visual LISP

 
Geometric Utilities
 
 
 

A group of functions allows applications to obtain pure geometric information and geometric data from the drawing. See Geometric Functions in AutoLISP Function Synopsis for a complete list of geometric utility functions.

The angle function finds the angle in radians between a line and the X axis (of the current UCS), distance finds the distance between two points, and polar finds a point by means of polar coordinates (relative to an initial point). The inters function finds the intersection of two lines. The osnap and textbox functions are described separately.

The following code fragment shows calls to the geometric utility functions:

(setq pt1 '(3.0 6.0 0.0))
(setq pt2 '(5.0 2.0 0.0))
(setq base '(1.0 7.0 0.0))
(setq rads  (angle pt1 pt2))    ; Angle in XY plane of current UCS
                                ; (value is returned in radians) 
(setq len  (distance pt1 pt2))  ; Distance in 3D space 
(setq endpt  (polar base rads len))

The call to polar sets endpt to a point that is the same distance from (1,7) as pt1 is from pt2, and at the same angle from the X axis as the angle between pt1 and pt2.