龙版主的程序好难懂,结果是ok,但自已一段一段执行下去想找到接口点,插程序进去就不行,; 错误: 参数类型错误: stringp 10.0 因为我想在龙版主的程序里插入如果用户输入空格将执行默认字高(if (= gs nil) (setq gs 3)),目前龙版主的程序不能接受空回车 本来很简单的程序,被我自已整的昏头了,下面的程序被整的无厘头了 (defun c:tt () (setvar "cmdecho" 0) (command "style" "HP-CHINESET" "txt.shx,CHINESET.shx" "" "0.7" "" "N" "N" "N") (if(not(tblsearch "layer" "TEXT")) (command "layer" "new" "TEXT" "set" "TEXT" "c" "4" "TEXT" "") (command "layer" "set" "TEXT" "c" "4" "TEXT" "") ) (princ "\nPick position to display Filename/Path : ") (setq vc (getvar "viewctr")) (setq pt (list (car vc) (cadr vc))) (setq dwgp (getvar "dwgprefix")) (setq dwgp0(substr dwgp 3 222)) (setq dwgp1 "SERVER") (setq dwgn (getvar "dwgname")) (setq username (getvar "loginname"))
(if (= "Server" (substr dwgp0 1 6)) (setq dwgp2(substr dwgp 9 222)) (setq dwgp2(substr dwgp 3 222)) ) (if (= gs nil) (setq gs 3)) ;(defun C:TT (/ ENP FLAG) (setq FLAG t) (while FLAG (cond ((= (progn (initget 128) (setq ENP (getpoint (strcat "\n FileName<A>/FilePath<B>/文字高度<" (rtos gs) ">:" ;程序不能接受默认值或者空回车 ) ) ) ) NIL ) (setq FLAG t) ) ((wcmatch (substr ENP 1 1) "[0-9]") (setq ENP (atof ENP) FLAG NIL ) ) ((wcmatch (setq ENP (strcase (substr ENP 1 1))) "[AaBb]") (setq FLAG NIL) ) ) ) ; ENP ;)
(cond ((and (= "B" enp)(= "b" enp)) ;如果enp=b时,gs文字高度应该为默认值 (progn (command "text" (list (car pt) (cadr pt)) gs (list (+ (car pt) 10) (cadr pt)) (strcat dwgp1 dwgp2 dwgn)) ) ) ((and (= "A" enp)(= "a" enp)) ;如果enp=a时,gs文字高度应该为默认值 (progn (setq filename(substr dwgn 1 (- (strlen dwgn) 4))) (command "text" (list (car pt) (cadr pt)) gs (list (+ (car pt) 10) (cadr pt)) filename)) ) (t (progn (setq filename(substr dwgn 1 (- (strlen dwgn) 4))) ;如果enp等于数字时,执行此段 ;目前此段根本就不成立,不管输入数字或是字母都是T (command "text" (list (car pt) (cadr pt)) enp (list (+ (car pt) 10) (cadr pt)) filename))) ) (command "move" (entlast) "" (list (car pt) (cadr pt)) pause ) (princ) ) |