- UID
- 676862
- 积分
- 213
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2013-5-30
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
这个是VBA程序 统一改图号的 谁看看能不能改写成VLISP程序
 - Dim Num As Integer
- Dim A() As String
- Sub ChangeTxt()
- 'On Error GoTo errhandle
- Dim Sset As AcadSelectionSet
- Dim Sset1 As AcadSelectionSet
- Dim FilterType(0) As Integer
- Dim FilterData(0) As Variant
- Dim AcadText As AcadText, NewText As AcadText, AcadText1 As AcadText
- Dim Num As Integer
- Dim Delete As Boolean
- Dim First As String, Second As String, Sep As Integer, TempText As String, InsertPoint As Variant, Points(2) As Double, Second1 As String
- Dim I As Integer
- Delete = False
- Num = 0
- 'Do
- FilterType(0) = 0
- FilterData(0) = "Text,Mtext"
- 'If Not IsNull(ThisDrawing.SelectionSets.Item("sse1")) Then
- 'Set SSet = ThisDrawing.SelectionSets.Item("sse1")
- 'SSet.Delete
- 'End If
- 'ZoomExtents
- '安全创建选择集
- Do While ThisDrawing.SelectionSets.Count > 0
- ThisDrawing.SelectionSets.Item(0).Delete
- Loop
- '创建选择集
- Set Sset = ThisDrawing.SelectionSets.Add("sse1")
- 'Set Sset1 = ThisDrawing.SelectionSets.Add("sse2")
- 'Sset1.Select acSelectionSetAll, , , FilterType, FilterData
- '提示用户选择
- Sset.SelectOnScreen FilterType, FilterData
- 'MsgBox SSet.Count
-
- If Sset.Count <> 0 Then
- For Each AcadText In Sset
- If InStr(AcadText.TextString, "-----") > 0 Then
- 'ReDim Preserve A(0 To Num)
- InsertPoint = AcadText.InsertionPoint
- TempText = AcadText.TextString
- Sep = InStr(TempText, "-")
- First = Left(TempText, Sep - 1)
- TempText = Right(TempText, 2)
- Second1 = Left(TempText, 1)
- Second = Left(TempText, 1)
- Select Case Second
- Case 1
- Second = "(一)"
- Case 2
- Second = "(二)"
-
- Case 3
- Second = "(三)"
- Case 4
- Second = "(四)"
- Case 5
- Second = "(五)"
- Case 6
- Second = "(六)"
- Case 7
- Second = "(七)"
- Case 8
- Second = "(八)"
- Case 9
- Second = "(九)"
- End Select
- Points(0) = InsertPoint(0) + 179.5: Points(1) = InsertPoint(1) - 233.2: Points(2) = InsertPoint(2)
- If Len(AcadText.TextString) <> 8 Then
- AcadText.TextString = First & "-----" & First & "'" & Second
- TempText = "2-" & First & "-" & Second1
- Else
- TempText = "2-" & First
-
- End If
-
- Set NewText = ThisDrawing.ModelSpace.AddText(TempText, Points, 3.5)
- NewText.StyleName = "ST"
- NewText.ScaleFactor = 1
- Num = Num + 1
- End If
- Next
- End If
-
- MsgBox "共修改了" & Num & "个文字。"
- Sset.Delete '及时删除选择集
- 'Sset1.Delete
- 'Loop
- errhandle:
- If Err.Number <> 0 Then
- Exit Sub
- End If
- '
- End Sub
|
-
-
acad.rar
7.55 KB, 下载次数: 5, 下载积分: D豆 -1 , 活跃度 1
|