多行文字每行画下划线
(defun c:wws(/ en wz wz1 )(setq en (entget (car(entsel))))
(setq wz (cdr (assoc 1 en )))
(setq wz1 (strcat "{\\L" wz "}"))
(setq en (subst (cons 1 wz1)(cons 1 wz)en))
(entmod en)
(prin1)
)
(defun c:wwe ()
(setq sh (getvar "peditaccept"))
(setvar "peditaccept" 0)
(setq osm (getvar "osmode"))
(setvar "osmode" 0)
;(setq mclayer (getvar "CLAYER"))
;(setvar "CLAYER" "0")
(setq ss1 (ssget '((0 . "*TEXT"))))
(if (null ss1)
(progn
(princ "\n没有文本实体被选择!")
(exit)
) ; end progn
) ; end if
(setq n (sslength ss1))
(if (not (= nil n)) ; no select objects
(progn
(setq i 0)
(while (< i n)
(setq txtentname (ssname ss1 i))
(setq txtentdata (entget txtentname))
(setq i (+ i 1))
(setq txtenttype (cdr (assoc 0 txtentdata))) ; get entity's name:
; "text" or "mtext"
(if (= txtenttype "TEXT") ; this object is simple line text
(progn
(vl-cmdf "ucs" "Object" txtentname) ; 定义用户坐标系到文本的方?
(setq tbox (textbox (list (car txtentdata))) ; must change to a list
pt_bl (car tbox) ; left bottom point coords
pttr (cadr tbox) ; right top point coords
pttl (list (car pt_bl) (cadr pttr))
pt_br (list (car pttr) (cadr pt_bl))
) ; end setq
(setq roundspace (* 0.2 (distance pt_bl pttl)))
(setq pt_bl (polar pt_bl pi (* roundspace 2)))
(setq pt_bl (polar pt_bl (* pi 1.5) roundspace))
(setq pt_br (polar pt_br 0.0 (* roundspace 2)))
(setq pt_br (polar pt_br (* pi 1.5) roundspace)) ;
;(command "pline" pt_bl "w" (* roundspace 0.25) "" pt_br "" "")
;(command "CHPROP" (entlast) "" "C" "BYBlock" "")
(command "pline" (polar pt_bl (* pi 1.5) (* roundspace 0.6)) "w" 0 "" (polar pt_br (* pi 1.5) (* roundspace 0.6)) "")
(command "CHPROP" (entlast) "" "C" "240" "")
(setvar "peditaccept" sh)
(vl-cmdf "ucs" "p" "")
) ; end progn
(progn
(vl-cmdf "_.JustifyText" txtentname "" "TL") ; 处理为对对齐模式.
(setq txtentdata (entget txtentname))
(setq pttl (cdr (assoc 10 txtentdata))
xwidth (cdr (assoc 42 txtentdata))
xheight (cdr (assoc 43 txtentdata))
xangle (cdr (assoc 50 txtentdata))
pt_tc (polar pttl xangle (* xwidth 0.5))
pttr (polar pttl xangle xwidth)
pt_bl (polar pttl (- xangle (/ pi 2.0)) xheight)
pt_bc (polar pt_bl xangle (* xwidth 0.5))
pt_br (polar pt_bl xangle xwidth)
pt_mc (polar pt_bl (angle pt_bl pttr) (/
(distance pt_bl
pttr
) 2.0 ; end
) ; end angle
) ; end polar
) ; end setq
(setq roundspace (* 0.2 (distance pt_bl pttl)))
(setq xangle (cdr (assoc 50 txtentdata)))
(setq pt_bl (polar pt_bl xangle (- roundspace)))
(setq pt_bl (polar pt_bl (+ xangle (/ pi 2.0)) (- roundspace)))
(setq pt_br (polar pt_br xangle roundspace))
(setq pt_br (polar pt_br (+ xangle (/ pi 2.0)) (- roundspace)))
(setq pttl (polar pttl xangle (- roundspace)))
(setq pttl (polar pttl (+ xangle (/ pi 2.0)) roundspace))
(setq pttr (polar pttr xangle roundspace))
(setq pttr (polar pttr (+ xangle (/ pi 2.0)) roundspace)) ;
;(command "pline" pt_bl "w" (* roundspace 0.25) "" pt_br "")
;(command "CHPROP" (entlast) "" "C" "BYBlock" "")
(command "pline" (polar pt_bl (* pi 1.5) (* roundspace 0.6)) "w" 0 "" (polar pt_br (* pi 1.5) (* roundspace 0.6)) "")
(command "CHPROP" (entlast) "" "C" "240" "") ; end command
(setvar "peditaccept" sh)
) ; end progn
) ; end if
) ; end while
) ; end progn
) ; end if
(setvar "CLAYER" mclayer)
(vl-cmdf "ucs" "W" "")
(setvar "osmode" osm)
(princ)
)
自贡黄明儒 发表于 2023-11-14 07:11
好像langjs大师写过,你找一下他的帖子
http://www.mjtd.com/home.php?mod=space&uid=52147&do=thread&vie ...
http://bbs.mjtd.com/thread-84999-1-1.html?_dsign=8d0395fc
大师,能帮忙整一下吗? 黄大师,还有看到你的文字穿的函数,有没从中间取出字符串的函数。substr试了下乱码。
现在有了多行文字加下划线,取掉下划线的时候,处理有问题,能帮忙看下?
U这种加减下划线的是不是有快捷键?比较乱,希望大师赐教 桌子只有一根下划线,你要2两根,只好用直线了。 多谢,是要直线,后面那个长代码只能适用多行文字为一行的情况,有没类似的代码或者函数发下参考下? 这是我一个QQ版的,把插件上传,看谁能破了。
wangsr 发表于 2023-11-13 16:58
这是我一个QQ版的,把插件上传,看谁能破了。
这个长代码就可以实现,里面有两个画线的命令,问题是多行文字多尴行数时候,每一行怎么都画直线? 好像langjs大师写过,你找一下他的帖子
http://www.mjtd.com/home.php?mod=space&uid=52147&do=thread&view=me&order=dateline&from=space&page=2 多行文本处理是炸开了变成单行了,大师不用炸开,还是需要多行文本的怎么处理?
页:
[1]
2