|
发表于 2005-8-12 15:35:00
|
显示全部楼层
Public Sub text()
On Error Resume Next
Dim ptInsert As Variant
Dim txtStr As String
Dim height As Double
Dim width As Double
Dim angle As Double
Dim SSet As AcadSelectionSet
If Not IsNull(ThisDrawing.SelectionSets.Item("this")) Then
Set SSet = ThisDrawing.SelectionSets.Item("this")
SSet.Delete
End If
Set SSet = ThisDrawing.SelectionSets.Add("this")
Dim FilterType(0 To 4) As Integer
Dim FilterData(0 To 4) As Variant
FilterType(0) = -4
FilterData(0) = ""
SSet.Select acSelectionSetAll, , , FilterType, FilterData
Dim objText As AcadText
For Each objText In SSet
ptInsert = objText.InsertionPoint
txtStr = objText.TextString
height = objText.height
angle = objText.Rotation
objText.Delete
A = txtStr
Dim B As Double
B = Right(A, 3)
Dim C As Double
C = CInt(B)
AddTextHA C, ptInsert, height, angle
objText.Update
Next
SSet.Delete
End Sub
X=123可以变为123,X=12.3变为2,X=1.23变为0 |
|