明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: ocoipw

[源码] 修改MTEXT或TEXT的高度

  [复制链接]
发表于 2025-12-12 12:37:47 | 显示全部楼层
支持天正可以哈6
回复 支持 反对

使用道具 举报

发表于 2025-12-13 21:52:54 | 显示全部楼层
天正多行文字是难点,没有什么方法能修改,我能实现天正单行文字的高和高宽比。
回复 支持 反对

使用道具 举报

发表于 2025-12-14 15:42:00 | 显示全部楼层
这个功能跟我写的一个插件差不多。这里还可以加上对多重引线文字的,多重引线文字字高组码是41
回复 支持 反对

使用道具 举报

发表于 2025-12-14 15:46:29 | 显示全部楼层
拿楼主的代码修改了一下。借花献佛。供大家参考。

  1. (defun c:11 ( / ss ss1 ent old_thight new_thight elist i e)
  2.   (setq ss (ssget ":S" '((0 . "MTEXT,TEXT,MULTILEADER"))))
  3.   (setq ent (cdr(assoc 0 (entget (ssname ss 0) ))))
  4.   (if (= ent "MULTILEADER")
  5.   (setq old_thight (rtos (cdr(assoc 41 (entget (ssname ss 0) )))))
  6.   (setq old_thight (rtos (cdr(assoc 40 (entget (ssname ss 0) )))))
  7.   )
  8.    (setq new_thight (getstring (strcat "\n请输入字符新高:" "<当前字高" old_thight ">")))
  9.    (if (= new_thight "") (setq new_thight old_thight))
  10. (setq i (sslength ss))
  11.   (while
  12.   (setq e (ssname ss (setq i (1- i))))
  13.   (setq ss1 (cdr (assoc 0 (entget e))))
  14.   (setq elist (entget e))
  15. (cond
  16. ((member ss1 '("TEXT" "MTEXT"))(entmod (subst (cons 40 (atof new_thight)) (assoc 40 elist) elist)))
  17. ((member ss1 '("MULTILEADER")) (entmod (subst (cons 41 (atof new_thight)) (assoc 41 elist) elist))  )
  18.   )
  19.   )
  20.   (princ (strcat "\n*** 已将 " (rtos (sslength ss)) " 个字符的高度替换为" new_thight " ***" ))
  21.   (princ))





回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-11 00:47 , Processed in 0.148614 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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