请高手改lisp
lihan1117
lihan1117 Lv.3
2006年11月24日 12:45:44
只看楼主

这是我在网上下的可以将文字内容刷成同样的lisp,但是只能一个一个的选,哪位高手能将它改成框选的啊,谢谢啦;;;文字内容格式刷TM(defun c:TM (/ e e2 ent ent2 en en2 newt oldt ent1 ent12 tst) (setq tst t) (setq e (car (entsel "\nPick a text or a attrib: ")))

这是我在网上下的可以将文字内容刷成同样的lisp,但是只能一个一个的选,哪位高手能将它改成框选的啊,谢谢啦


;;;文字内容格式刷TM

(defun c:TM (/ e e2 ent ent2 en en2 newt oldt ent1 ent12 tst)
(setq tst t)
(setq e (car (entsel "\nPick a text or a attrib: ")))
(if (/= e nil)
(progn
(setq ent (entget e))
(cond
((and (= (cdr (assoc 0 ent)) "INSERT")
(= (cdr (assoc 66 ent)) 1)
)
(progn
(setq en (entget (setq ent (entnext e))))
(setq oldt (cdr (assoc 1 en)))
)
)
((= (cdr (assoc 0 ent)) "TEXT")
(setq oldt (cdr (assoc 1 ent)))
)
(T
(princ
"\nError: Not a text or not a block or no attrib in block !"
)
(setq tst nil)
)
)
)
(setq tst nil)
)
;;;----------------------------------------------------------------------
(while tst
(setq e2 (car (entsel "\nPick New a text or a attrib: ")))
(if (/= e2 nil)
(progn
(setq ent2 (entget e2))
(cond
((and (= (cdr (assoc 0 ent2)) "INSERT")
(= (cdr (assoc 66 ent2)) 1)
)
(progn
(setq en2 (entget (setq ent2 (entnext e2))))
(setq newt oldt)
(setq ent12
(subst (cons (car (assoc 1 en2)) newt) (assoc 1 en2) en2)
)
(entmod ent12)
(entupd ent2)
)
)
((= (cdr (assoc 0 ent2)) "TEXT")
(progn
(setq newt oldt)
(setq ent12 (subst (cons (car (assoc 1 ent2)) newt)
(assoc 1 ent2)
ent2
)
)
(entmod ent12)
)
)
(T
(princ
"\nError: Not a text or not a block or no attrib in block !"
)
(setq tst nil)
)
)
)
(setq tst nil)
)
)
;;;----------------------------------------------------------------------
(princ)
)
免费打赏
zyhjiao
2006年11月24日 21:44:05
2楼
改动后如下:

(defun c:TM (/ e e2 ent ent2 en en2 newt oldt ent1 ent12 tst num)
(setq tst t)
(setq e (car (entsel "\nPick a text or a attrib: ")))
(if (/= e nil)
(progn
(setq ent (entget e))
(cond
((and (= (cdr (assoc 0 ent)) "INSERT")
(= (cdr (assoc 66 ent)) 1)
)
(progn
(setq en (entget (setq ent (entnext e))))
(setq oldt (cdr (assoc 1 en)))
)
)
((= (cdr (assoc 0 ent)) "TEXT")
(setq oldt (cdr (assoc 1 ent)))
)
(T
(princ
"\nError: Not a text or not a block or no attrib in block !"
)
(setq tst nil)
)
)
)
(setq tst nil)
)
;;;----------------------------------------------------------------------
(princ "\nPick New a text or a attrib: ")
(setq e2 (ssget)
num 0)
(while tst
(if (/= e2 nil)
(progn
(repeat (sslength e2)
(setq ent2 (entget (ssname e2 num)))
(cond
((and (= (cdr (assoc 0 ent2)) "INSERT")
(= (cdr (assoc 66 ent2)) 1)
)
(progn
(setq en2 (entget (setq ent2 (entnext e2))))
(setq newt oldt)
(setq ent12
(subst (cons (car (assoc 1 en2)) newt) (assoc 1 en2) en2)
);setq
(entmod ent12)
(entupd ent2)
);progn
);cond1
((= (cdr (assoc 0 ent2)) "TEXT")
(progn
(setq newt oldt)
(setq ent12 (subst (cons (car (assoc 1 ent2)) newt)
(assoc 1 ent2)
ent2
)
);setq
(entmod ent12)
);progn
);cond2
(T
(princ "\nError: Not a text or not a block or no attrib in block !" )
(setq tst nil)
);cond3
);cond
(setq num (1+ num))
);regeat
);progn
(setq tst nil)
);if
);while
;;;----------------------------------------------------------------------
(princ)
);end
(princ "\ntm加载完毕,输入tm执行文字内容格式刷")
(princ)
回复
lihan1117
2006年11月27日 12:10:46
3楼
非常感谢
果然高手云集:)
回复
水的畅想
2007年04月05日 09:07:27
4楼

同感~~
回复
sgc26
2007年11月30日 17:14:23
5楼
牛呀
有没有可以同时该标注尺寸
回复
zyhjiao
2007年12月01日 00:03:22
6楼
添加标注后如下:
(defun c:rw (/ e e2 ent ent2 en en2 newt oldt ent1 ent12 tst num) ;/ e e2 ent ent2 en en2 newt oldt ent1 ent12 tst
(setq tst t)
(setq e (car (entsel "\nPick a text or a attrib OR A DIMENSION: ")))
(redraw e 3)
(if (/= e nil)
(progn
(setq ent (entget e))
(cond
((and (= (cdr (assoc 0 ent)) "INSERT")
(= (cdr (assoc 66 ent)) 1)
)
(progn
(setq en (entget (setq ent (entnext e))))
(setq oldt (cdr (assoc 1 en)))
)
);cond1
((OR (= (cdr (assoc 0 ent)) "TEXT") (= (cdr (assoc 0 ent)) "DIMENSION"))
(setq oldt (cdr (assoc 1 ent)))
);cond2
(T
(princ "\nError: Not a text or not a block or no attrib in block !")
(setq tst nil)
);cond3
);cond
);progn
(setq tst nil)
);if
;;;----------------------------------------------------------------------
(princ "\nPick New a text or a attrib: ")
(setq e2 (ssget)
num 0)
(redraw E 4)
(while tst
(if (/= e2 nil)
(progn
(repeat (sslength e2)
(setq ent2 (entget (ssname e2 num)))
(cond
((and (= (cdr (assoc 0 ent2)) "INSERT")
(= (cdr (assoc 66 ent2)) 1)
)
(progn
(setq en2 (entget (setq ent21 (entnext ent2))))
(setq newt oldt)
(setq ent12 (subst (cons (car (assoc 1 en2)) newt) (assoc 1 en2) en2))
(entmod ent12)
(entupd ent21)
);progn
);cond1
((OR (= (cdr (assoc 0 ent)) "TEXT") (= (cdr (assoc 0 ent)) "DIMENSION"))
(progn
(setq newt oldt)
(setq ent12 (subst (cons (car (assoc 1 ent2)) newt) (assoc 1 ent2) ent2 ));setq
(entmod ent12)
);progn
);cond2
(T
(princ "\nError: Not a text or not a block or no attrib in block !" )
(setq tst nil)
);cond3
);cond
(setq num (1+ num))
);regeat
);progn
(setq tst nil)
);if
);while
;;;----------------------------------------------------------------------
(princ)
);end
(princ "\ntm加载完毕,输入rw执行文字内容格式刷")
(princ)
回复
sgc26
2007年12月27日 11:31:05
7楼
牛呀
回复
liweiping97065
2008年03月22日 19:14:14
8楼
添加标注的那个程序怎么用啊,我好想知道啊
回复
honker1981
2008年04月04日 12:59:33
9楼
刷尺寸的那个怎么不能用啊
回复

相关推荐

APP内打开