home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
GR
/
GR505.ZIP
/
LSP.EXE
/
EXTLINE.LSP
< prev
next >
Wrap
Text File
|
1988-05-23
|
3KB
|
69 lines
; EXTENDLINE will extend a selected line so that it is perpendicular to a
; selected point.
; a -starting point of selected line
; b -ending point of selected line
; c -point to which line is to be extended perp. to
; d -point on a line thru pt. c that is perp to line AB
; e -entity group for the selected line
; f -point of intersection btw'n lines AB & CD
; np -endpt. of line AB closest to c
; fp -endpt. of line AB furthest from c
; deltax -delta x between a & b
; deltay -delta y between a & b
(defun C:EL ()
(setq e (entget (car (entsel "\nPick the line to extend : "))))
(setq c (getpoint "\nPick the point to extend to : "))
(if (or (null e) (null c)) (prompt " Somethings wrong. Try again.")
(progn
(setq a (cdr (assoc 10 e))
b (cdr (assoc 11 e))) ; name the endpoints
(if (> (distance a c)(distance b c))
(setq np b fp a agroup 11) ; then
(setq np a fp b agroup 10) ; else
)
(setq deltax (- (car np)(car fp))
deltay (- (cadr np)(cadr fp)))
(setq d (list (- (car c) deltay)(+ (cadr c) deltax)))
(setq f (cons agroup (inters a b c d nil)))
(setq e (subst f (assoc agroup e) e))
(entmod e)
))
(princ)
)
; EXTENDLINE will extend a selected line a user supplied distance.
; Variables:
; a -starting point of selected line
; b -ending point of selected line
; c -how far the line is to be extended
; e -entity group for the selected line
; f -point @ distance c from np
; np -endpt. of line AB closest to c
; fp -endpt. of line AB furthest from c
; g -point @ which line was picked
; h -angle of line AB from fp to np
(defun C:ELD ()
(setq e (entsel "\nPick the line to extend : "))
(setq g (cadr e))
(setq e (car e))
(setq e (entget e))
(setq c (getdist "\nHow far? : "))
(if (or (null e) (null c)) (prompt " Somethings wrong. Try again.")
(progn
(setq a (cdr (assoc 10 e))
b (cdr (assoc 11 e))) ; name the endpoints
(if (> (distance a g)(distance b g))
(setq np b fp a agroup 11) ; then
(setq np a fp b agroup 10) ; else
)
(setq h (angle fp np)) ; Get the angle of the line.
(setq f (cons agroup (polar np h c))) ;
(setq e (subst f (assoc agroup e) e))
(entmod e)
))
(princ)
)