home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Share Gallery 1
/
share_gal_1.zip
/
share_gal_1
/
GR
/
GR505.ZIP
/
LSP.EXE
/
ACAD.LSP
next >
Wrap
Text File
|
1988-03-11
|
4KB
|
150 lines
(setq name "Allen")
;
; TURN OFF/ON COMMAND LINE
(defun echooff()
(setq echo (getvar "cmdecho"))
(setvar "cmdecho" 0)
)
(defun echoon()
(setvar "cmdecho" echo)
)
; CHANGE N FROM RADIANS TO DEGREES
(defun rtd(n)
(* n (/ 180.0 PI))
)
; ROUTINE TO DRAW A SQUARE
(defun c:square(/ pt1 pt2 pt3 pt4 len)
(graphscr)
(echooff)
(setq pt1 (getpoint"\nLower left corner ? "))
(setq len (getdist pt1 "\nLength of a side ? "))
(setq pt2 (polar pt1 0.0 len))
(setq pt3 (polar pt2 (/ PI 2.0) len))
(setq pt4 (polar pt3 PI len))
(setvar"blipmode"0)
(command "line" pt1 pt2 pt3 pt4 "C")
(setvar"blipmode"1)
(echoon)
)
; ROUTINE TO DRAW A RECTANGLE
(defun c:rectangle (/ pt1 pt2 pt3 pt4)
(graphscr)
(echooff)
(setq pt1 (getpoint "\nFirst point of rectangle..."))(terpri)
(setq pt3 (getcorner "Second corner of rectangle..."pt1))
(setq pt2 (list (car pt1)(cadr pt3)))
(setvar"blipmode"0)
(setq pt4 (list (car pt3)(cadr pt1)))
(command"line" pt1 pt2 pt3 pt4 "c")
(setvar"blipmode"1)
(echoon)
)
; EDIT TEXT WITHOUT TYPING THE WHOLE LINE
;
(defun C:CHGTEXT (/ p l n e os as ns st s nsl osl sl si chf chm cont)
(graphscr)
(echooff)
(setq chm 0 p (ssget)) ; Select objects
(if p (progn ; If any objects selected
(setq cont t)
(while cont
(setq osl (strlen (setq os (getstring "\nOld string ? " t))))
(if (= osl 0)
(princ "Null input is invalid! ")
(setq cont nil)
)
)
(setq nsl (strlen (setq ns (getstring "\nNew string ? " t))))
(setq l 0 n (sslength p))
(while (< l n) ; For each selected object...
(if (= "TEXT" ; Look for TEXT entity type (group 0)
(cdr (assoc 0 (setq e (entget (ssname p l))))))
(progn
(setq chf nil si 1)
(setq s (cdr (setq as (assoc 1 e))))
(while (= osl (setq sl (strlen
(setq st (substr s si osl)))))
(if (= st os)
(progn
(setq s (strcat (substr s 1 (1- si)) ns
(substr s (+ si osl))))
(setq chf t) ; Found old string
(setq si (+ si nsl))
)
(setq si (1+ si))
)
)
(if chf (progn ; Substitute new string for old
(setq e (subst (cons 1 s) as e))
(entmod e) ; Modify the TEXT entity
(setq chm (1+ chm))
))
)
)
(setq l (1+ l))
)
))
(princ "You changed ") ; Print total lines changed
(princ chm)
(princ " text line(s), ")(princ name)
(terpri)
(echoon)
)
; ROUTINE TO SIGN YOUR NAME
(defun c:signit (/ x cp)
(echooff)
(graphscr)
(setq cp (getpoint"\nEnter the center point of your name.."))
(princ"....Thank You, ")(princ name)(princ"! ")
(command"text""s""scripts""c" cp "90" name)
(setvar"blipmode"0)
(setvar"highlight"0)
(setq x (getvar "cdate"))
(setq x (rtos x 2 0))
(setq date (strcat
(substr x 5 2) "/" ;month
(substr x 7 2) "/" ;day
(substr x 3 2))) ;year
(command "text" "" date)
(command"text""s""simplex""c" cp "" "")
(setvar"blipmode"1)
(setvar"highlight"1)
(echoon)
)
; ROUTINE JUST TO PRINT THE DATE
(defun c:dateit (/ cp x)
(echooff)
(graphscr)
(setq cp (getpoint"\nEnter the center point of the date....."))
(princ"Thank You, ")(princ name)(princ"! ")
(setq x (getvar "cdate"))
(setq x (rtos x 2 0))
(setq date (strcat
(substr x 5 2) "/" ;month
(substr x 7 2) "/" ;day
(substr x 3 2))) ;year
(command "text""c" cp "90" date)
(echoon)
)
; THIS ROUTINE ERASES THE EXTENTS OF YOUR DRAWING!
(defun c:ew (/ l u)
(graphscr)
(echooff)
(setvar"blipmode"0)
(setvar"highlight"0)
(setq l (getvar "extmin"))
(setq u (getvar "extmax"))
(command "erase""c" l u "")
(command "zoom""a")
(command "redraw")
(princ"O.K., ")(princ name)(princ", all done....! ")
(setvar"blipmode"1)
(setvar"highlight"1)
(echoon)
)
; CLEAN THE ATOMLIST
(defun c:clean ()
(setq atomlist (member 'c:clean atomlist))
'Done
)