我试图弄明白:
这意味着什么
9=“03B”?
28=“10R”?
38=“13Y”?
如果我是对的,那么你可以试试下面的代码,
命令:BRY
选择文字或多行文字
- ;Add incremental suffix B R Y
- ;hp# 22/07/14
- ;http://www.cadtutor.net/forum/showthread.php?87667-Need-some-lisp...
- (defun C:BRY (/ *error* e tx #)
- (defun *error* (msg)
- (if (wcmatch (strcase msg) "*CANCEL*,*EXIT*")
- (princ msg)
- (princ (strcat "\n*Error: " msg))
- )
- )
- (while (setq e (entsel "\nSelect *TEXT: ")) ; *edited thanx mr.Tharwat
- (if (and (setq e (car e))
- (setq tx (cdr (assoc 1 (entget e))))
- (/= (setq # (atof tx)) 0)
- ;(not (wcmatch (strcase tx) "*B,*R,*Y")) ; *removed
- (numberp(read tx)) ; *added
- )
- (vla-put-textstring
- (vlax-ename->vla-object e)
- ('((# / i n)
- (setq
- n
- (fix (abs #))
- i
- (rem n 3.))
- (strcat
- (if
- (minusp #)
- "-"
- (if
- (< n 10)
- "0"
- ""))
- (rtos
- (if
- (zerop i)
- (/ n 3.)
- (1+ (fix (/ n 3.))))
- 2
- 0)
- (cond
- ((zerop i) "B")
- ((= i 1) "R")
- ((= i 2) "Y"))))
- #)))))
- (princ "command: BRY")
- (princ)
|