明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2153|回复: 3

更改字高程序没有效果(已解决)

[复制链接]
发表于 2011-11-22 20:31:17 | 显示全部楼层 |阅读模式
本帖最后由 vbyu1987 于 2011-11-22 20:47 编辑

(defun c:gzg(/ h e e1)
        (setq h(getdist "\n输入文本新的字高:"))
        (setq e (entnext))                       ;得到第一个图元的名字
        (while e
                (setq e1 (entget e))        
                (if (= "TEXT" (cdr (assoc o e1)))
                        (progn
                                (setq e1 (subst (cons 40 h) (assoc 40 e1) e1))
                                (if (= 3 (cdr (assoc 72 e1)))
                                        (setq e1 (subst (cons 72 0) (assoc 72 e1) e1))
                                )
                                (entmod e1)
                        )
                )
                (setq e (entnext e))
        )
)

这是按照一本lisp教材上做的程序,检查了好几遍也没有错误,但是就是没有效果

发表于 2011-11-22 20:43:46 | 显示全部楼层
(assoc o e1)
先试==>
(assoc 0 e1)
 楼主| 发表于 2011-11-22 20:46:16 | 显示全部楼层
Andyhon 发表于 2011-11-22 20:43
(assoc o e1)
先试==>
(assoc 0 e1)

非常感谢,,,唉。。。
 楼主| 发表于 2011-11-22 21:00:53 | 显示全部楼层
(defun c:gzg(/ h e e1)
        (setq h(getdist "\n输入文本新的字高:"))
        (setq e (entnext))                       ;得到第一个图元的名字
        (while e
                (setq e1 (entget e))        
                (if (= "TEXT" (cdr (assoc 0 e1)))
                        (progn
                                (setq e1 (subst (cons 40 h) (assoc 40 e1) e1))
                                (if (= 3 (cdr (assoc 72 e1)))
                                        (setq e1 (subst (cons 72 0) (assoc 72 e1) e1))
                                )
                                (entmod e1)
                        )
                )
                (if (= "MTEXT" (cdr (assoc 0 e1)))
                        (progn
                                (setq e1 (subst (cons 40 h) (assoc 40 e1) e1))
                                (if (= 3 (cdr (assoc 72 e1)))
                                        (setq e1 (subst (cons 72 0) (assoc 72 e1) e1))
                                )
                                (entmod e1)
                        )
                )
                (setq e (entnext e))
        )
)

将程序改了下,现在可以实现对单行文字和多行文字全部自动改高度了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-7-23 12:12 , Processed in 0.173383 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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