本帖最后由 tiancao100 于 2024-5-26 14:03 编辑
https://www.bilibili.com/video/B ... 145ded3c6f58c7e8d37
- <CommandMethod("TcTxtDaoXu")>
- Public Sub TcTxtDaoXu()
- On Error Resume Next
- Dim acDc As Document = Application.DocumentManager.MdiActiveDocument
- Dim acDb As Database = acDc.Database
- Dim acTypValAr(0) As TypedValue
- acTypValAr.SetValue(New TypedValue(DxfCode.Start, "TEXT"), 0)
- Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr)
- Dim acSSPrompt As PromptSelectionResult = acDc.Editor.GetSelection(acSelFtr)
- If acSSPrompt.Status = PromptStatus.OK Then '选择成功
- Dim acSS As SelectionSet = acSSPrompt.Value
- For Each id As ObjectId In acSS.GetObjectIds
- Using acTrans As Transaction = acDb.TransactionManager.StartTransaction()
- Dim acTxt As DBText = acTrans.GetObject(id, OpenMode.ForWrite)
- Dim str As String = acTxt.TextString
- Dim strArr As Char() = str.ToCharArray
- Array.Reverse(strArr)
- Dim NewStr As New String(strArr)
- acTxt.TextString = NewStr
- acTrans.Commit()
- End Using
- Next
- End If
- End Sub
|