明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2795|回复: 6

求助: 有调整文字行间距的程序吗?

[复制链接]
发表于 2005-4-23 11:28:00 | 显示全部楼层 |阅读模式
请教各位: 哪位有修改行间距的lsp程序.能否提供一个.非常感谢.
发表于 2005-5-11 00:00:00 | 显示全部楼层
(defun c:Td (/ TxtSS L_TxtSS ct MY_ALL txt FY TH
MY MY_ALL ct index Y_min Y_max key ct
num txtEnt txt gc72 gc73 U_O U_FX U_FY
U_FZ W_O NewFP txt
)
(princ "\n请选择需要排列的文字:")
(setq TxtSS (ssget '((0 . "TEXT")))
L_TxtSS (sslength TxtSS)
ct 0
MY_ALL nil
) ;_ end of setq
(while (< ct L_TxtSS)
(setq txt (entget (ssname TxtSS ct))
FY (cadr (trans (cdr (assoc 10 txt)) 0 1))
TH (cdr (assoc 40 txt))
MY (+ FY (/ Th 2))
MY_ALL (append MY_ALL (list MY))
ct (1+ ct)
)
) ;_ end of while
(setq index (vl-sort-i MY_ALL '<)
Y_min (nth (nth 0 index) MY_ALL)
Y_max (nth (nth (1- L_TxtSS) index) MY_ALL)
)
(initget 128 "S I")
(setq
key (getkword "\n[输入行间距(I)/根据所选文字确定行间距(S)]<S>: "
) ;_ end of getkword
) ;_ end of setq
(if (/= key nil)
(setq key (strcase key))
) ;_ end of if
(if (or (= key "S") (= key nil)) ;_ end of or
(setq deta_y (/ (- Y_max Y_min) (1- L_TxtSS)))
(if (= key "I")
(progn (princ "请输入行间距:") (setq deta_y (getdist))) ;_ end of progn
) ;_ end of if
) ;_ end of if
(setq ct 1)
(while (< ct L_TxtSS)
(setq num (nth ct index)
txtEnt (ssname TxtSS num)
txt (entget txtEnt)
gc72 (cdr (assoc 72 txt))
gc73 (cdr (assoc 73 txt))
) ;_ end of setq
(setq Y_Y (- (nth num MY_ALL) (+ y_min (* ct deta_y))) ;_ end of -
) ;_ end of setq
(if (and (= 0 gc72) (= 0 gc73))
(progn (setq U_O (trans (cdr (assoc 10 txt)) 0 1)
U_FX (car U_O)
U_FY (- (cadr U_O) Y_Y)
U_FZ (caddr U_O)
W_O (trans (list U_FX U_FY U_FZ) 1 0)
NewFP (list 10 (car W_O) (cadr W_O) (caddr W_O))
txt (subst NewFP (assoc 10 txt) txt)
)
(entmod txt)
(entupd txtent)
) ;_ end of progn
(progn (setq U_O (trans (cdr (assoc 11 txt)) 0 1)
U_FX (car U_O)
U_FY (- (cadr U_O) Y_Y)
U_FZ (caddr U_O)
W_O (trans (list U_FX U_FY U_FZ) 1 0)
NewFP (list 11 (car W_O) (cadr W_O) (caddr W_O))
txt (subst NewFP (assoc 11 txt) txt)
)
(entmod txt)
(entupd txtent)
) ;_ end of progn
) ;_ end of if
(setq ct (1+ ct))
) ;_ end of while
(princ)
) ;_ end of defun
回复 支持 1 反对 0

使用道具 举报

发表于 2005-4-24 21:20:00 | 显示全部楼层
在VB那个专栏里,明总的对齐与分布程序就很不错,我用用很长时间了
发表于 2005-5-16 17:49:00 | 显示全部楼层
楼上,谢谢了!不错很好用!
发表于 2013-2-3 10:40:37 | 显示全部楼层
感谢分享
发表于 2013-7-17 15:36:27 | 显示全部楼层
非常感谢!
发表于 2025-3-19 13:00:42 | 显示全部楼层
感谢分享,牛
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-4-1 09:07 , Processed in 0.167234 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表