home *** CD-ROM | disk | FTP | other *** search
- ;****** TY\CHASTR.LSP ****** 10-15-89 BJ
- (defun C:CHASTR ( )
- (setq wcy 1)
- (while wcy
- ; (setq mode (getint "\n 0mppp/1c-zh/2c-za/3c-zw/4c-lay
- (setq mode (getint "\n 1c-zh/2c-za/3c-zw/4c-lay/5c-color
- 6FD/7LJ/8CR*/9CR1/10PL/11c-str1/12c-str*:"))
- (if (null mode) (setq wcy nil))
- ; (if (null mode) (setq wcy nil) (mppp))
- ; (if (= mode 0) (setq ppp (ssget)))
- (if (= mode 1) (progn (mppp) (csh)))
- (if (= mode 2) (progn (mppp) (csa)))
- (if (= mode 3) (progn (mppp) (csw)))
- (if (= mode 4) (progn (setq dh (getstring "New layer:"))
- (command "change" ppp "" "lay" dh "")))
- (if (= mode 5) (progn (setq dh (getstring "New color:"))
- (command "change" ppp "" "p" "color" dh "")))
- (if (= mode 6) (fd))
- (if (= mode 7) (lj))
- (if (= mode 8) (progn (mppp) (cr*)))
- (if (= mode 9) (cr1))
- (if (= mode 10) (progn (mppp) (pl)))
- (if (= mode 11) (progn (mppp) (c-str1)))
- (if (= mode 12) (progn (mppp) (c-str*)))
- )
- )
- ;------------
- (defun mppp ( )
- (if ppp (prompt "\n Made ppp <old>,") (prompt "\n Made ppp,"))
- (setq new (ssget))
- (if new (setq ppp new))
- ; (if (null ppp) (setq ppp (ssget)))
- )
- ;------------
- (defun csh ( )
- ; (if (null ppp) (setq ppp (ssget)))
- (setq nsh (getreal "enter nsh <3.5>:"))
- (if (null nsh) (setq nsh 3.5))
- (setq nsh (* 100 tb nsh))
- (setq wxr 0 n (sslength ppp))
- (while (< wxr n)
- (setq ss (entget (ssname ppp wxr)))
- (if (= (cdr (assoc 0 ss)) "TEXT") (progn
- (setq ss (subst (cons 40 nsh) (assoc 40 ss) ss))
- (entmod ss)))
- (setq wxr (1+ wxr))
- )
- )
- ;------------
- (defun csa ( )
- ; (if (null ppp) (setq ppp (ssget)))
- (setq nsa (getangle "enter nsa <0.0>:"))
- (if (null nsa) (setq nsa 0.0))
- (setq wxr 0 n (sslength ppp))
- (while (< wxr n)
- (setq ss (entget (ssname ppp wxr)))
- (if (= (cdr (assoc 0 ss)) "TEXT") (progn
- (setq ss (subst (cons 50 nsa) (assoc 50 ss) ss))
- (entmod ss)))
- (setq wxr (1+ wxr))
- )
- )
- ;------------
- (defun csw ( )
- ; (if (null ppp) (setq ppp (ssget)))
- (setq nsw (getreal "enter nsw <1.0>:"))
- (if (null nsw) (setq nsw 1.0))
- (setq wxr 0 n (sslength ppp))
- (while (< wxr n)
- (setq ss (entget (ssname ppp wxr)))
- (if (= (cdr (assoc 0 ss)) "TEXT") (progn
- (setq ss (subst (cons 41 nsw) (assoc 41 ss) ss))
- (entmod ss)))
- (setq wxr (1+ wxr))
- )
- )
- ;------------
- (defun fd ( / k pt)
- (setq sss (entget (setq sss0 (car (entsel "select string:")))))
- (if (= (cdr (assoc 0 sss)) "TEXT") (progn
- (setq s12 (cdr (assoc 1 sss)))
- (setq k (getint "enter int k:"))
- (if (< k 0) (setq k (+ (strlen s12) k)))
- (setq s1 (substr s12 1 k))
- (setq s2 (substr s12 (+ k 1)))
- (setq sss (subst (cons 1 s1) (cons 1 s12) sss))
- (entmod sss)
- (setq pt (cdr (assoc 10 sss)))
- (command "copy" sss0 "" pt
- (setq pt (polar pt (cdr (assoc 50 sss))
- (* k (cdr (assoc 40 sss)) (cdr (assoc 41 sss))))))
- (setq sss (entget (ssname (ssget "last") 0)))
- (setq s12 (assoc 1 sss))
- (setq sss (subst (cons 1 s2) s12 sss))
- (entmod sss)
- ))
- (princ)
- )
- ;-------------------
- (defun cr* ( / k)
- (setq -s- (getstring "enter string for CR:"))
- (setq k (getint "enter int k <-1,0,1...>:"))
- (setq wxr 0 n (sslength ppp))
- (while (< wxr n)
- (setq es (entget (setq e (ssname ppp wxr))))
- (if (= (cdr (assoc 0 es)) "TEXT") (progn
- (setq s (cdr (assoc 1 es)))
- (if (< k 0) (setq k (+ (strlen s) k -1)))
- (setq s1 (substr s 1 k))
- (setq s2 (substr s (+ k 1)))
- (setq ns (strcat s1 -s- s2))
- (setq es (subst (cons 1 ns) (assoc 1 es) es))
- (entmod es)))
- (setq wxr (1+ wxr))
- )
- (princ)
- )
- ;-------------------
- (defun cr1 ( / k pt)
- (setq sss (entget (setq sss0 (car (entsel "select string:")))))
- (if (= (cdr (assoc 0 sss)) "TEXT") (progn
- (setq s12 (cdr (assoc 1 sss)))
- (setq k (getint "enter int k:"))
- (if (< k 0) (setq k (+ (strlen s12) k)))
- (setq s1 (substr s12 1 k))
- (setq s2 (substr s12 (+ k 1)))
- (setq s1-2 (getstring "enter string for CR:"))
- (if (= s1-2 "") (setq s1-2 " "))
- (setq sss (subst (cons 1 (strcat s1 s1-2 s2)) (cons 1 s12) sss))
- (entmod sss)
- ))
- (princ)
- )
- ;-------------------
- (defun lj ( )
- (setq sss (entget (setq sss0 (car (entsel "\n forst string:")))))
- (if (= (cdr (assoc 0 sss)) "TEXT") (progn
- (setq s12 (cdr (assoc 1 sss)))
- (setq wcy 1 ns12 s12)
- (while wcy
- (setq ss (entsel "\n next string <or RETURN for none>:"))
- (if (= ss nil) (setq wcy nil) (lj01))
- )
- (setq sss (subst (cons 1 ns12) (cons 1 s12) sss))
- (entmod sss)
- ))
- (princ)
- )
- (defun lj01 ( )
- (setq ss (entget (setq ss0 (car ss))))
- (redraw ss0 3)
- ; (entdel ss0)
- (if (= (cdr (assoc 0 ss)) "TEXT") (progn
- (setq ss (cdr (assoc 1 ss)))
- (setq ns12 (strcat ns12 ss))
- (redraw ss0 4)
- ))
- )
- ;-------------------
- (defun pl ( )
- ; (if (null ppp) (setq ppp (ssget)))
- (setq pt (getpoint "Start point:"))
- (setq zh (getreal "enter zh <3.5>:"))
- (if (null zh) (setq zh 3.5))
- (setq zh (* 100 tb zh))
- (setq kk (getreal "enter ZJ <2.0>:"))
- (if (null kk) (setq kk 2.0))
- (setq k 0 n (sslength ppp))
- (while (< k n)
- (setq ss (entget (setq ss0 (ssname ppp k))))
- (if (= (cdr (assoc 0 ss)) "TEXT")
- (command "text" (polar pt (* -0.5 pi) (* kk k zh))
- zh 0.0 (cdr (assoc 1 ss))))
- (setq k (1+ k))
- )
- )
- ;-------------------
- (defun c-str* ( )
- (setq wxr 0 n (sslength ppp))
- (while (< wxr n)
- (setq ss (entget (setq ss0 (ssname ppp wxr))))
- (if (= (cdr (assoc 0 ss)) "TEXT") (progn
- ; (redraw ss0 3)
- ; (setq old (cdr (assoc 1 ss)))
- (setq new (strcase (cdr (assoc 1 ss))))
- ; (setq new (getstring (strcat "\n new string:")))
- (if (/= new "") (setq ss (subst (cons 1 new) (assoc 1 ss) ss)))
- ; (redraw ss0 4)
- (entmod ss)))
- (setq wxr (1+ wxr))
- )
- )
- (defun c-str1 ( )
- ; (if (null ppp) (setq ppp (ssget)))
- (setq wxr 0 n (sslength ppp))
- (while (< wxr n)
- (setq ss (entget (setq ss0 (ssname ppp wxr))))
- (if (= (cdr (assoc 0 ss)) "TEXT") (progn
- (redraw ss0 3)
- (setq old (cdr (assoc 1 ss)))
- ; (setq new (getstring (strcat "\n new string<" old ">:")))
- (setq new (getstring (strcat "\n new string:")))
- (if (/= new "") (setq ss (subst (cons 1 new) (assoc 1 ss) ss)))
- (redraw ss0 4)
- (entmod ss)))
- (setq wxr (1+ wxr))
- )
- )
- ;(defun c-str1 (/ adj l n e os as ns st s nsl osl sl si chf chm)
- (defun c-str* ( )
- ; (if (null ppp) (setq ppp (ssget)))
- (if ppp (progn
- (setq osl (strlen (setq os (getstring "\n old string:" t))))
- (setq nsl (strlen (setq ns (getstring "\n new string:" t))))
- (setq l 0 chm 0 n (sslength ppp))
- (setq adj
- (cond ((/= osl nsl) (- nsl osl)) (T nsl)))
- (while (< l n)
- (if (= "TEXT" (cdr (assoc 0 (setq e (entget (ssname ppp 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) (setq si (+ si adj))
- ))
- (setq si (1+ si))
- )
- (if chf (progn
- (setq e (subst (cons 1 s) as e))
- (entmod e)
- (setq chm (1+ chm))
- ))
- )
- )
- (setq l (1+ l))
- )
- ))
- (princ "Changed ") (princ chm) (princ " text lines.") (terpri)
- )
- ; (setq wxr 0 n (sslength ppp))
- ; (while (< wxr n)
- ; (setq ss (entget (setq ss0 (ssname ppp wxr))))
- ; (if (= (cdr (assoc 0 ss)) "TEXT") (progn
- ; (redraw ss0 3)
- ; (setq old (cdr (assoc 1 ss)))
- ; (setq new (getstring (strcat "\n new string<" old ">:")))
- ; (if (/= new "") (setq ss (subst (cons 1 new) (assoc 1 ss) ss)))
- ; (redraw ss0 4)
- ; (entmod ss)))
- ; (setq wxr (1+ wxr))
- ; )
- ;)
- (defun C:CLEAN2 ( )
- (setq atomlist (member 'C:CLEAN2 atomlist))
- 'DONE2)