<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) <> 0
pStr = pStr & Left(str, 1) & "\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" & vbCr & "l" & vbCr & 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) <> 0
pStr = pStr & Left(str, 1) & "\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" & vbCr & "l" & vbCr & vbCr
pText.Delete
End Sub
</FONT>
[此贴子已经被作者于2004-7-14 7:07:59编辑过]
|