自贡黄明儒
发表于 2014-1-28 09:16:26
ZZXXQQ 发表于 2014-1-28 08:44 static/image/common/back.gif
觉得TENT开始的数据要反过来,这样在后面再次颠倒时才正确。
MTEXT的插入点在左上角,这可以用函数计算出来 ...
感谢楼上三位热情回复,那么下面就成了
;;单行文字变多行文字(text2mtext (car(entsel)))
(defun text2mtext (e / ANG EN HEI INS LAY OBJ P10 STR STY TENT)
;(setq e (car(entsel)))
(setq obj (vlax-ename->vla-object e))
(setq ins (vlax-get obj 'insertionPoint))
(setq hei (vlax-get obj 'Height))
(setq ang (vlax-get obj 'ObliqueAngle))
(setq p10 (polar ins (+ (* pi 0.5) ang) hei))
(setq str (vlax-get obj 'textstring))
(setq sty (vlax-get obj 'stylename))
(setq Lay (vlax-get obj 'layer))
(setq en (entget e))
(Setq TENT (list '(0 . "MTEXT")
(cons 8 Lay)
'(100 . "AcDbEntity")
'(100 . "AcDbMText")
(cons 7 sty)
(cons 1 str)
(cons 10 p10)
)
)
(entdel e)
(EntMake TENT)
)
sachindkini
发表于 2014-1-28 13:18:31
Text2MText Upgraded
Program DescriptionA 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 UsageCombining Three DText Objects into a Single MText Object
qjchen
发表于 2014-1-28 13:40:51
Express tool 里面的Text , Convert Text to Mtext,个人觉得挺好用的
自贡黄明儒
发表于 2014-1-28 14:57:23
qjchen 发表于 2014-1-28 13:40 static/image/common/back.gif
Express tool 里面的Text , Convert Text to Mtext,个人觉得挺好用的
是呀,好象是text2Mtext,关键好多人不知道什么叫ET,而且我也常忘记安装ET.最近来打算写一个文本集成工具。击文本执行12个命令,干脆一下弄进去算了。
qjchen
发表于 2014-1-29 09:14:30
自贡黄明儒 发表于 2014-1-28 14:57 static/image/common/back.gif
是呀,好象是text2Mtext,关键好多人不知道什么叫ET,而且我也常忘记安装ET.最近来打算写一个文本集成工具 ...
自己编当然是很好的事情
文字编辑方面,个人觉得coolzhb朋友写的 文字修改大师 或者 酷周工具箱
http://coolzhb.ys168.com/?jdfwkey=ovwch3
都是很好的,几乎能想到的大部分都有了
自贡黄明儒
发表于 2014-2-7 08:45:13
qjchen 发表于 2014-1-29 09:14 static/image/common/back.gif
自己编当然是很好的事情
文字编辑方面,个人觉得coolzhb朋友写的 文字修改大师 或者 酷周工具箱
虽然很强大,但我更关注批量处理。
llsheng_73
发表于 2014-2-7 11:21:22
(defun text2mtext (e / EN)
(EntMake
(setq en(entget e)
en(list '(0 . "MTEXT")(assoc 8 en)'(100 . "AcDbEntity")'(100 . "AcDbMText")(assoc 7 en)(assoc 1 en)
(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))))
)
))(entdel e)
)
把老黄这个改了下,效果是一样的,但文字是左对齐的时候会有一点移位,正中不会,其它对齐方式没测试
无厘崖
发表于 2015-8-17 15:12:31
sachindkini 发表于 2014-1-28 13:18 static/image/common/back.gif
Text2MText Upgraded
Program DescriptionA dynamic variation on the familiar Express Tools function,...
you
are so
good!
773786668
发表于 2016-6-1 03:19:54
本帖最后由 773786668 于 2016-6-1 03:29 编辑
精华帖,学习了,哈哈 不过有个问题,为什么加载了黄总的代码,会提示分配给保护的符号...后面一串提示
iamhuangjinming
发表于 2016-6-26 13:01:20
很好用,谢谢楼主,哈哈