home *** CD-ROM | disk | FTP | other *** search
- (defun MODES (a)
- (setq MLST '())
- (repeat (length a)
- (setq MLST (append MLST (list (list (car a) (getvar (car a))))))
- (setq a (cdr a))
- )
- )
- (defun MODER ()
- (repeat (length MLST)
- (setvar (caar MLST) (cadar MLST))
- (setq MLST (cdr MLST))
- )
- )
- (defun myerror (st)
- (if (/= st "Function cancelled")
- (princ (strcat "\nError: " st))
- )
- (moder)
- (setq *error* olderr)
- (princ)
- )
- (defun RTD (y)
- (* 180. (/ y pi))
- )
- (defun DTR (y)
- (* pi (/ y 180.))
- )
- (defun C:CTEXT ()
- (setvar "BLIPMODE" 0)
- (setvar "CMDECHO" 0)
- (modes '("BLIPMODE" "CMDECHO"))
- (graphscr)
- (princ "Please select HZ style:")
- (initget 2 "Singleline-hz Doubleline-hz")
- (setq hz (getstring "\nSingleline-hz/Doubleline-hz/<standard-hz>:"))
- (cond ((eq hz "s") (COMMAND "STYLE" "HZ" "TXT,HZTXT" "" "0.75" "" "" ""))
- ((eq hz "d") (COMMAND "STYLE" "HZ1" "TXT,HZTXT1" "" "0.75" "" "" ""))
- ((eq hz "") (COMMAND "STYLE" "HZ0" "TXT,HZTXT0" "" "0.75" "" "" ""))
- (T (princ "Unknown HZ style !"))
- )
- (setq cst (getvar "textstyle"))
- (if (= interface nul) (setq interface "P"))
- (if (or (= interface "W") (= interface "w"))
- (princ "\nCurrent Interface is WBX")
- (princ "\nCurrent Interface is Py.")
- )
- (setq olderr *error*
- *error* myerror)
- (modes '("BLIPMODE" "CMDECHO"))
- (graphscr)
- (initget 1 "Center Fit Middle Right Interface")
- (setq pt (getpoint "\n<Start point or Center>/Fit/Middle/Right/Interface :"))
- (if (/= (type pt) 'LIST)
- (if (= pt "Interface")
- (progn
- (initget "Wbx Py")
- (setq interfaces (getkword "\n Wbx or Py :"))
- (setq interface (substr interfaces 1 1))
- (setq pt (getpoint "\n<Start point or Center>/Fit/Middle/Right:"))
- )
- )
- )
- (if (/= (type pt) 'LIST)
- (setq j (substr pt 1 1))
- (setq j "L")
- )
-
- (if (/= (type pt) 'LIST)
- (if (= pt "Fit")
- (progn
- (initget 1)
- (setq ptf (getpoint "Fist text line point: "))
- (setq pt ptf)
- (initget 1)
- (setq pts (getpoint "Second text line point: "))
- (setq k 1)
- )
- (progn
- (initget 1)
- (setq pt (getpoint (strcat "\n" pt " point: ")))
- )
- )
- )
- (initget 6)
- (setq h (getdist pt (strcat "\nHeight <"
- (rtos (getvar "TEXTSIZE"))
- ">: "
- )
- )
- )
- (if (null h) (setq h (getvar "textsize")))
- (if (/= k 1)
- (progn
- (if (null a$$)
- (progn
- (if (= (cdr (assoc 70 ts)) 4) ;Vertical style text
- (progn
- (setq a$$ 270)
- (prompt "\nRotational angle <270>: ")
- )
- (progn
- (setq a$$ 0)
- (prompt "\nRotational angle <0>: ")
- )
- )
- )
- (progn
- (prompt "\nRotational angle <")
- (princ (strcat (angtos a$$) ">: "))
- )
- )
- (setq ang (getangle pt))
- (if (null ang) (setq ang a$$))
- (setq a$$ ang)
- )
- )
- (if (or (= interface "P") (= interface "p")) (command "AVCAD")(command "AVCAD W"))
- (setq f (open "chstr.dat" "r"))
- (setq eoff 1)
- (setq st (read-line f))
- (cond ((and (= j "L") h)
- (while (= eoff 1)
- (command "TEXT" "s" cst pt h (rtd ang) st)
- (setq OLDx (car pt))
- (setq oldy (cadr pt))
- (setq newX (+ oldX (* (sin ANG) H (/ 1. 0.6))))
- (setq newy (- oldy (* (cos ANG) H (/ 1. 0.6))))
- (setq pt (list NEWX NEWY))
- (setq st (read-line f))
- (if (= st nil)(setq eoff 2))
- )
- )
- ((and (/= j "L") (/= j "F") h)
- (command "TEXT" "s" cst j pt h (rtd ang) st)
- )
- ((and (/= j "L") (= j "F") h)
- (command "TEXT" "s" cst j ptf pts h st)
- )
- )
- (moder)
- (setq *error* olderr)
- (close f)
- (command "text" "s" cst ^c)
- (redraw)
- (princ)
- )
-
-
- (defun C:EPT (/ olds oldss olds1 stp h txt wf st x0 y0 l n yes
- TXTA TXT1 NN AR AD CL cst)
- (setq olderr *error*
- *error* myerror)
- (setvar "BLIPMODE" 0)
- (setvar "CMDECHO" 0)
- (SETQ CL (GETVAR "CLAYER"))
- (setq cst (getvar "textstyle"))
- (setq olds (entsel "\nSelect the string :"))
- (SETQ OLDSS (CAR OLDS))
- (setq olds (entget (car olds)))
- (setq olds1 (cdr (assoc 0 olds)))
- (if (= "TEXT" oldS1)
- ( progn
- (COMMAND "ERASE" (SSADD OLDSS) "")
- (COMMAND "LAYER" "S" (CDR (ASSOC 8 OLDS)) "")
- (setq stp (trans (cdr (assoc 10 olds)) 0 1))
- (setq h (cdr (assoc 40 olds)))
- (setq aR (cdr (assoc 50 olds)))
- (setq aD (RTD (cdr (assoc 50 olds))))
- (setq txt (cdr (assoc 1 olds)))
- (setq wf (Cdr (assoc 41 olds)))
- (SETQ ST (CDR (ASSOC 7 OLDS)))
- (SETQ X0 (CAR STP) Y0 (CADR STP))
- (setq l (strlen txt))
- (setq n 1) (setq nn 2)
- (setq yes 1)
- (while (<= N L)
- (setq tXT1 (substr txt n 2))
- (SETQ TXTA (ASCII TXT1))
- (setq nn (cond
- ((= TXT1 "%%") 3)
- ((> Txta 160) 2)
- ((< Txta 129) 1)
- )
- )
- (setq txt1 (substr txt n nn))
- (setq n (+ n nn))
- (command "text" "S" ST stp h aD txt1)
-
- (IF (= NN 2)
- (PROGN
- (cond ((eq cst "HZ") (setq wscale 1.0625))
- ((eq cst "HZ1") (setq wscale 1.20))
- ((eq cst "HZ0") (setq wscale 1.40))
- )
- (SETQ X0 (+ X0 (* (cos aR) H WF wscale)))
- (SETQ y0 (+ Y0 (* (sin aR) H WF wscale)))
- )
- (PROGN
- (SETQ JF (COND
- ((= TXTA 49) 0.65)
- ((= TXTA 46) 0.3)
- (T 1)
- )
- )
- (setq wf1 (* JF WF))
- (SETQ X0 (+ X0 (* (cos aR) H WF1)))
- (SETQ y0 (+ Y0 (* (sin aR) H WF1)))
- )
- )
- (SETQ STP (LIST X0 Y0))
-
- )
- )
- )
- (COMMAND "LAYER" "S" CL "")
- (command "text" "s" cst ^c)
- (setq *error* olderr)
- (princ)
- )
-
- (DEFUN C:HZFILE(/ TXT SP TH INS WD STL LS DT)
- (setvar "BLIPMODE" 0)
- (SETVAR "CMDECHO" 0)
- (modes '("BLIPMODE" "CMDECHO"))
- (graphscr)
- (SETQ TXT (OPEN (GETSTRING "\n Name of Text File(WordStar): ") "r"))
- (SETQ SP (GETPOINT "\n Text String Start Point :"))
- (SETQ INS (GETSTRING"\n Enter Line Spacing in Drawing Units :"))
- (SETQ HT (GETSTRING "\n Enter Text Height in Drawing Units :"))
- (SETQ WD (GETSTRING "\n Enter Text Width Factor :"))
- (princ "Please select HZ style:")
- (initget 2 "Singleline-hz Doubleline-hz")
- (setq hz (getstring "\nSingleline-hz/Doubleline-hz/<standard-hz>:"))
- (setq pname (getvar "dwgprefix"))
- (cond ((eq hz "s") (COMMAND "STYLE" "HZ" "txt,hztxt" HT WD "" "" ""))
- ((eq hz "d") (COMMAND "STYLE" "HZ1" "txt,hztxt1" HT WD "" "" ""))
- ((eq hz "") (COMMAND "STYLE" "HZ0" "txt,hztxt0" HT WD "" "" ""))
- (T (princ "Unknown HZ style ! Restart HZFILE command."))
- )
-
- (SETQ DT (READ-LINE TXT))
- (SETQ LS (STRCAT "@"INS"<-90"))
- (COMMAND"TEXT" SP "" DT)
- (WHILE (/= DT NIL)
- (SETQ DT (READ-LINE TXT))
- (COMMAND"TEXT" LS "" DT)
- )
- (COMMAND"REDRAW")
- )
-
- ; For other Autolisp aplication
- (DEFUN C:BOX () (LOAD "BOX")(C:BOX))
- (DEFUN C:MXB () (LOAD "MXB")(C:MXB))
- (DEFUN C:CL () (LOAD "CL")(C:CL))
- (DEFUN C:TH () (LOAD "TH")(C:TH))
- (DEFUN C:LD () (LOAD "LEADER")(C:LD))
- (DEFUN C:CHGTEXT () (LOAD "CHGTEXT")(C:CHGTEXT))
- (DEFUN C:LTEXT () (LOAD "LTEXT")(C:LTEXT))
- (DEFUN C:LEXPLODE () (LOAD "LEXPLODE")(C:LEXPLODE))
- (DEFUN SSX () (LOAD "SSX")(SSX))
-
- ;Setup environment
- (DEFUN C:ENVIRON () (LOAD "ENVIRON")(C:ENVIRON))
-
-
- ;For clean memery
- (defun C:CLEAN () (SETQ ATOMLIST (MEMBER 'C:CLEAN ATOMLIST)))
-
- ;For ctext, box ,mxb, ld ,...
- (DEFUN S::STARTUP ()
- (setvar "cmdecho" 0)
- (setvar "blipmode" 0)
-
- (IF (= (TBLSEARCH "STYLE" "A") NUL)
- (COMMAND "STYLE" "A" "COMPLEX" "6" "0.8" "" "" "" ""))
- (IF (= (TBLSEARCH "STYLE" "HZ") NUL)
- (COMMAND "STYLE" "HZ" "TXT,HZTXT" "" "0.75" "" "" ""))
- (IF (= (TBLSEARCH "STYLE" "ASC") NUL)
- (COMMAND "STYLE" "ASC" "TXT" "" "0.75" "" "" "" ""))
- (IF (= (TBLSEARCH "LAYER" "1") NUL)
- (COMMAND "LAYER" "N" "1" "C" "1" "1" "LT" "CENTER" "1" ""))
- (IF (= (TBLSEARCH "LAYER" "4") NUL)
- (COMMAND "LAYER" "N" "4" "C" "4" "4" "LT" "" "1" ""))
- (IF (= (TBLSEARCH "LAYER" "5") NUL)
- (COMMAND "LAYER" "N" "5" "C" "6" "5" "LT" "" "5" ""))
-
- (setvar "textsize" 4.8)
- (princ)
- )
- ;
- (princ)
-