- UID
- 76911
- 积分
- 428
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-9-3
- 最后登录
- 1970-1-1
|
发表于 2005-1-21 09:29:13
|
显示全部楼层
express tools里的acetext.lsp
[PHP]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; TCOUNT TEXT COUNT
(defun c:tcount ( / ss_sort ss start inc startinc flag flt n)
(acet-error-init
(list (list "cmdecho" 0
"highlight" (getvar "highlight")
"limcheck" 0
);list
T
);list
);acet-error-init
(setq flt '((-4 . "<OR")
(0 . "TEXT")
(0 . "MTEXT")
(0 . "ATTDEF")
(-4 . "OR>")
)
);setq
(if (and (setq ss (ssget flt));setq
(setq ss (car (acet-ss-filter (list ss
'(("LAYERUNLOCKED") ;Dis-allow locked layers, non-current-space
("CURRENTUCS") ;and dis-allow objects not in current ucs
)
T
);list
);acet-ss-filter
);car
);setq
);and
(progn
(if (not #bns_tcount_sort)
(setq #bns_tcount_sort "Select-order")
);if
(initget "X Y Select-order")
(setq ss_sort (getkword (acet-str-format
"\nSort selected objects by [X/Y/Select-order] <%1>: "
#bns_tcount_sort
);acet-str-format
);getkword
);setq
(if (or (not ss_sort)
(equal ss_sort "")
);or
(setq ss_sort #bns_tcount_sort);setq then
(setq #bns_tcount_sort ss_sort);setq else
);if
(if (not #bns_tcount_start)
(setq #bns_tcount_start 1)
);if
(if (not #bns_tcount_inc)
(setq #bns_tcount_inc 1)
);if
(while (not flag)
(setq flag T)
(setq startinc (strcat (itoa (fix #bns_tcount_start)) ","
(itoa (fix #bns_tcount_inc))
);strcat
startinc (getstring (acet-str-format
"\nSpecify starting number and increment (Start,increment) <%1>: "
startinc
);acet-str-format
);getstring
);setq
(if (equal startinc "")
(setq startinc (strcat (itoa (fix #bns_tcount_start)) ","
(itoa (fix #bns_tcount_inc))
);strcat
);setq
);if
(setq startinc (acet-str-to-list "," startinc))
(if (or (not (car startinc))
(not (numberp (read (car startinc))))
(and (cadr startinc)
(not (numberp (read (cadr startinc))))
);and
);or
(progn
(princ "\nInvalid input.")
(setq flag nil)
);progn then
);if
(setq start (atoi (car startinc)));setq
(if (cadr startinc)
(setq inc (atoi (cadr startinc)));setq then
(setq inc 1);setq else
);if
(if start
(setq #bns_tcount_start start)
);if
(if (or (not inc)
(equal inc 0)
);or
(setq inc #bns_tcount_inc);setq then
);if
(if inc
(setq #bns_tcount_inc inc)
);if
);while
(bns_get_tcountmode_cmd)
(setq n (bns_tcount
ss ;the selection set
ss_sort ;the sort type
start ;the start number
inc ;the increment
#bns_tcount_mode ;placement mode =overwrite/prefix/suffix/find&replace
#bns_tcount_replace ;search string for Find&replace option.
)
);setq
(princ (acet-str-format "\n%1 objects modified." (itoa n)))
(if ss
(command "_.select" ss "")
);if
);progn then
);if
(acet-error-restore)
);defun c:tcount
[/PHP] |
|