tyrasv 发表于 2014-12-30 21:44
我只要个下划线,就行了,你给的太复杂了。
用6楼的改了一下,其实楼主也可以自己改一下的,自己改才是适合自己想要的效果:
不支持mtext,是mtext要先炸开.- ;;文字下画线
- (defun c:tt(/ dd ss i ssn ssdata box p1 p2 p3 p4 ang)
- (command "_.undo" "_be")
- (setq ss(ssget '((0 . "text"))))
- (setq i 0)
- (repeat (sslength ss)
- (setq ssn (ssname ss i))
- (setq ssdata (entget ssn))
- (setq key (cdr (assoc 0 ssdata)))
- (command "ucs" "e" ssn)
- (setq box (textbox ssdata))
- (setq p1 (car box))
- (setq p3 (cadr box))
- (setq p2(list (car p3)(cadr p1)))
- (setq p4(list (car p1)(cadr p3)))
- (setq dd (* (distance p1 p4) 0.1) );;线与字间距
- (setq ang (angle p1 p4))
- (setvar "PLINEWID" (* dd 0.5)) ;下划线宽
- (command "pline" "non" (polar (polar p1 (- ang)dd)pi (* dd 2)) "non" (polar (polar p2 (- ang)dd) (* pi 2) (* dd 2)) "")
- (setq i (1+ i))
- )
- (command "ucs" "")
- (command "_.undo" "_e")
- (setvar "PLINEWID" 0)
- (prin1)
- )
|