用属性替换块
请提供lisp,用另一个块及其相关属性替换所选块。 (DEFUN c:CG4 (/ x len indx alist alist2 n_ent o_ent inspt_nblk inspt_oblk atlist atval)(setvar "cmdecho" 1)
(princ "\nSelect blocks to change...")
(setq x (SSGET)
len (SSLENGTH x)
indx -1
)
(princ "\nSelect attribute to place...")
(setq atlist (entget (car (nentsel))))
(setq atval (cdr (assoc 1 atlist)))
(setq alist2 (entget (car (entsel "\nSelect new block to replace the old:")))
n_ent (cdr (assoc -1 alist2))
inspt_nblk (cdr(assoc 10 alist2))
)
(REPEAT len
(SETQ indx (1+ indx)
alist (ENTGET (SSNAME x indx))
o_ent (cdr (assoc -1 alist))
inspt_oblk (cdr (assoc 10 alist))
rot (rtd (cdr (assoc 50 alist)))
)
(command "copy" n_ent "" inspt_nblk inspt_oblk
"rotate" "l" "" inspt_oblk rot
"erase" o_ent ""
)
)
(command "-attedit" "" "" "" "" pause "" "v" "r" atval "")
(setvar "cmdecho" 1)
(princ)
)
(print "...Please type 'CG4' ")
(princ)
试试这个,
这不是我的,我们已经使用这个例程一段时间了,但忘记了我从哪里得到这个。
页:
[1]