koalabear 发表于 2005-4-23 11:28:00

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

请教各位: 哪位有修改行间距的lsp程序.能否提供一个.非常感谢.

tc405003 发表于 2005-5-11 00:00:00

(defun c:Td (/ TxtSS       L_TxtSS                                                       ct                                               MY_ALL txt                               FY                       TH <BR>                                                                               MY                               MY_ALL ct                                                       index       Y_min       Y_max                               key                       ct <BR>                                                                               num                       txtEnt txt                       gc72               gc73                                       U_O                               U_FX                       U_FY <BR>                                                                               U_FZ               W_O                       NewFP       txt <BR>                                                                       ) <BR>       (princ "\n请选择需要排列的文字:") <BR>       (setq                       TxtSS                       (ssget '((0 . "TEXT"))) <BR>                       L_TxtSS                       (sslength TxtSS) <BR>                       ct                       0 <BR>                       MY_ALL                       nil <BR>       ) ;_ end of setq <BR>       (while (&lt; ct L_TxtSS) <BR>                       (setq txt                               (entget (ssname TxtSS ct)) <BR>                                       FY                               (cadr (trans (cdr (assoc 10 txt)) 0 1)) <BR>                                       TH                               (cdr (assoc 40 txt)) <BR>                                       MY                               (+ FY (/ Th 2)) <BR>                                       MY_ALL (append MY_ALL (list MY)) <BR>                                       ct                               (1+ ct) <BR>                       ) <BR>       ) ;_ end of while <BR>       (setq                       index (vl-sort-i MY_ALL '&lt;) <BR>                       Y_min (nth (nth 0 index) MY_ALL) <BR>                       Y_max (nth (nth (1- L_TxtSS) index) MY_ALL) <BR>       ) <BR>       (initget 128 "S I") <BR>       (setq <BR>                       key                       (getkword "\n[输入行间距(I)/根据所选文字确定行间距(S)]&lt;S&gt;: " <BR>                       ) ;_ end of getkword <BR>       ) ;_ end of setq <BR>       (if (/= key nil) <BR>                       (setq key (strcase key)) <BR>       ) ;_ end of if <BR>       (if (or (= key "S") (= key nil)) ;_ end of or <BR>                       (setq deta_y (/ (- Y_max Y_min) (1- L_TxtSS))) <BR>                       (if                       (= key "I") <BR>                                       (progn (princ "请输入行间距:") (setq deta_y (getdist))) ;_ end of progn <BR>                       ) ;_ end of if <BR>       ) ;_ end of if <BR>       (setq ct 1) <BR>       (while (&lt; ct L_TxtSS) <BR>                       (setq num                               (nth ct index) <BR>                                       txtEnt (ssname TxtSS num) <BR>                                       txt                               (entget txtEnt) <BR>                                       gc72                               (cdr (assoc 72 txt)) <BR>                                       gc73                               (cdr (assoc 73 txt)) <BR>                       ) ;_ end of setq <BR>                       (setq Y_Y (- (nth num MY_ALL) (+ y_min (* ct deta_y))) ;_ end of - <BR>                       ) ;_ end of setq <BR>                       (if                       (and (= 0 gc72) (= 0 gc73)) <BR>                                       (progn (setq U_O                               (trans (cdr (assoc 10 txt)) 0 1) <BR>                                                                               U_FX                               (car U_O) <BR>                                                                               U_FY                               (- (cadr U_O) Y_Y) <BR>                                                                               U_FZ                               (caddr U_O) <BR>                                                                               W_O                               (trans (list U_FX U_FY U_FZ) 1 0) <BR>                                                                               NewFP (list 10 (car W_O) (cadr W_O) (caddr W_O)) <BR>                                                                               txt                               (subst NewFP (assoc 10 txt) txt) <BR>                                                               ) <BR>                                                               (entmod txt) <BR>                                                               (entupd txtent) <BR>                                       ) ;_ end of progn <BR>                                       (progn (setq U_O                               (trans (cdr (assoc 11 txt)) 0 1) <BR>                                                                               U_FX                               (car U_O) <BR>                                                                               U_FY                               (- (cadr U_O) Y_Y) <BR>                                                                               U_FZ                               (caddr U_O) <BR>                                                                               W_O                               (trans (list U_FX U_FY U_FZ) 1 0) <BR>                                                                               NewFP (list 11 (car W_O) (cadr W_O) (caddr W_O)) <BR>                                                                               txt                               (subst NewFP (assoc 11 txt) txt) <BR>                                                               ) <BR>                                                               (entmod txt) <BR>                                                               (entupd txtent) <BR>                                       ) ;_ end of progn <BR>                       ) ;_ end of if <BR>                       (setq ct (1+ ct)) <BR>       ) ;_ end of while <BR>       (princ) <BR>) ;_ end of defun<BR>

andyding 发表于 2005-4-24 21:20:00

在VB那个专栏里,明总的对齐与分布程序就很不错,我用用很长时间了

zichang 发表于 2005-5-16 17:49:00

楼上,谢谢了!不错很好用!

wjm867 发表于 2013-2-3 10:40:37

感谢分享

wkyuok 发表于 2013-7-17 15:36:27

非常感谢!

魔教中人 发表于 2025-3-19 13:00:42

感谢分享,牛
页: [1]
查看完整版本: 求助: 有调整文字行间距的程序吗?