找回密码
 [加入论坛]
查看: 1204|回复: 0

[转帖]TEXT文本水平,垂直分解

[复制链接]
2443725 发表于 2004-7-18 15:10 | 显示全部楼层 |阅读模式
<FONT face=宋体>'text字符串分解-垂直排列   修改by陌生人
'修改 from lzh
Public Sub Textexv()
Dim pText As AcadEntity
Dim pnt
ThisDrawing.Utility.GetEntity pText, pnt
Dim str As String
str = pText.TextString
Dim pStr As String
Dim Txth As Double
Txth = pText.Height
Dim inspt As ACAD_POINT
inspt = pText.InsertionPoint
Dim polarPnt As ACAD_POINT
polarPnt = ThisDrawing.Utility.PolarPoint(inspt, (pText.Rotation + 1.57079), Txth)
Do While Len(str) &lt;&gt; 0
pStr = pStr &amp; Left(str, 1) &amp; "\P"
str = Right(str, Len(str) - 1)
Loop
Set mT = ThisDrawing.ModelSpace.AddMText(polarPnt, 0, pStr)
mT.Height = Txth
mT.Rotation = pText.Rotation
mT.StyleName = pText.StyleName
ThisDrawing.SendCommand "Explode" &amp; vbCr &amp; "l" &amp; vbCr &amp; vbCr
pText.Delete
End Sub


'text字符串分解-水平排列  by陌生人
Public Sub Textexh()
Dim pText As AcadEntity
Dim pnt
ThisDrawing.Utility.GetEntity pText, pnt
Dim str As String
str = pText.TextString
Dim pStr As String
Dim Txth As Double
Txth = pText.Height
Dim inspt As ACAD_POINT
inspt = pText.InsertionPoint
Dim polarPnt As ACAD_POINT
polarPnt = ThisDrawing.Utility.PolarPoint(inspt, (pText.Rotation + 1.57079), Txth)
Do While Len(str) &lt;&gt; 0
pStr = pStr &amp; Left(str, 1) &amp; "\H1X"
str = Right(str, Len(str) - 1)
Loop
Set mT = ThisDrawing.ModelSpace.AddMText(polarPnt, 0, pStr)
mT.Height = Txth
mT.Rotation = pText.Rotation
mT.StyleName = pText.StyleName
ThisDrawing.SendCommand "Explode" &amp; vbCr &amp; "l" &amp; vbCr &amp; vbCr
pText.Delete
End Sub
</FONT>
您需要登录后才可以回帖 登录 | [加入论坛]

本版积分规则

手机版|化工技术网- 赠人玫瑰 手有余香 ( 苏ICP备14035884号 )

GMT+8, 2026-12-1 16:18

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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