明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: 自贡黄明儒

[已解答] Text转Mtext

  [复制链接]
 楼主| 发表于 2014-1-28 09:16 | 显示全部楼层
ZZXXQQ 发表于 2014-1-28 08:44
觉得TENT开始的数据要反过来,这样在后面再次颠倒时才正确。
MTEXT的插入点在左上角,这可以用函数计算出来 ...

感谢楼上三位热情回复,那么下面就成了
  1. ;;单行文字变多行文字(text2mtext (car(entsel)))
  2. (defun text2mtext (e / ANG EN HEI INS LAY OBJ P10 STR STY TENT)
  3.   ;(setq e (car(entsel)))
  4.   (setq obj (vlax-ename->vla-object e))
  5.   (setq ins (vlax-get obj 'insertionPoint))
  6.   (setq hei (vlax-get obj 'Height))
  7.   (setq ang (vlax-get obj 'ObliqueAngle))
  8.   (setq p10 (polar ins (+ (* pi 0.5) ang) hei))
  9.   (setq str (vlax-get obj 'textstring))
  10.   (setq sty (vlax-get obj 'stylename))
  11.   (setq Lay (vlax-get obj 'layer))
  12.   (setq en (entget e))  
  13.   (Setq        TENT (list '(0 . "MTEXT")
  14.                    (cons 8 Lay)
  15.                    '(100 . "AcDbEntity")
  16.                    '(100 . "AcDbMText")                    
  17.                    (cons 7 sty)
  18.                    (cons 1 str)
  19.                    (cons 10 p10)
  20.              )
  21.   )  
  22.   (entdel e)  
  23.   (EntMake TENT)
  24. )
回复

使用道具 举报

发表于 2014-1-28 13:18 | 显示全部楼层
Text2MText Upgraded

Program Description
A dynamic variation on the familiar Express Tools function, this program allows the user to dynamically amalgamate several separate MText & DText objects into a single MText object, with all formatting remaining in tact. The user is also provided with additional options to control how text strings are combined.
Text will take on the layer of the first text entity chosen (as per the behaviour of the Express Tools function), but will keep its colour if not set to ByLayer.
The user is provided with two modes of operation: Same Line & New Line, which may be switched by pressing the spacebar between selections. When operating inSame Line mode, new text is appended to the end of the last line in the resulting MText object, whereas the New Line mode forces selected text to begin on a new line.
Shift-Clicking on Text object will keep the original object in place, whilst still add its string to the resultant MText; and upon pressing u between selections, the last text selected will be removed from the resultant MText object.



Examples of Usage
Combining Three DText Objects into a Single MText Object















本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x

点评

Box can be selected instead of from left to right, from top to bottom?  发表于 2015-9-6 22:59
thanks!!  发表于 2014-1-28 14:58
回复

使用道具 举报

发表于 2014-1-28 13:40 | 显示全部楼层
Express tool 里面的Text , Convert Text to Mtext,个人觉得挺好用的
回复

使用道具 举报

 楼主| 发表于 2014-1-28 14:57 | 显示全部楼层
qjchen 发表于 2014-1-28 13:40
Express tool 里面的Text , Convert Text to Mtext,个人觉得挺好用的

是呀,好象是text2Mtext,关键好多人不知道什么叫ET,而且我也常忘记安装ET.最近来打算写一个文本集成工具。击文本执行12个命令,干脆一下弄进去算了。
回复

使用道具 举报

发表于 2014-1-29 09:14 | 显示全部楼层
自贡黄明儒 发表于 2014-1-28 14:57
是呀,好象是text2Mtext,关键好多人不知道什么叫ET,而且我也常忘记安装ET.最近来打算写一个文本集成工具 ...

自己编当然是很好的事情

文字编辑方面,个人觉得coolzhb朋友写的 文字修改大师 或者 酷周工具箱

http://coolzhb.ys168.com/?jdfwkey=ovwch3

都是很好的,几乎能想到的大部分都有了

评分

参与人数 1明经币 +1 收起 理由
自贡黄明儒 + 1 指示的文修大师确实很强大

查看全部评分

回复

使用道具 举报

 楼主| 发表于 2014-2-7 08:45 | 显示全部楼层
qjchen 发表于 2014-1-29 09:14
自己编当然是很好的事情

文字编辑方面,个人觉得coolzhb朋友写的 文字修改大师 或者 酷周工具箱

虽然很强大,但我更关注批量处理。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
回复

使用道具 举报

发表于 2014-2-7 11:21 | 显示全部楼层
  1. (defun text2mtext (e / EN)
  2.   (EntMake
  3.     (setq en(entget e)
  4.           en(list '(0 . "MTEXT")(assoc 8 en)'(100 . "AcDbEntity")'(100 . "AcDbMText")(assoc 7 en)(assoc 1 en)
  5.                    (cons 10(polar(if(equal'(0 0 0)(cdr(assoc 10 en)))(cdr(assoc 11 en))(cdr(assoc 10 en)))(+(* pi 0.5)(cdr(assoc 50 en)))(cdr(assoc 40 en))))
  6.              )
  7.   ))(entdel e)
  8. )


把老黄这个改了下,效果是一样的,但文字是左对齐的时候会有一点移位,正中不会,其它对齐方式没测试
回复

使用道具 举报

发表于 2015-8-17 15:12 | 显示全部楼层
sachindkini 发表于 2014-1-28 13:18
Text2MText Upgraded
Program DescriptionA dynamic variation on the familiar Express Tools function,  ...

you
are so
good!
回复

使用道具 举报

发表于 2016-6-1 03:19 | 显示全部楼层
本帖最后由 773786668 于 2016-6-1 03:29 编辑

精华帖,学习了,哈哈 不过有个问题,为什么加载了黄总的代码,会提示分配给保护的符号...后面一串提示
回复

使用道具 举报

发表于 2016-6-26 13:01 | 显示全部楼层
很好用,谢谢楼主,哈哈
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-17 20:25 , Processed in 0.141324 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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