明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 509|回复: 4

[基础] CAD文字倒序

[复制链接]
发表于 2024-5-26 13:55 | 显示全部楼层 |阅读模式
本帖最后由 tiancao100 于 2024-5-26 14:03 编辑

https://www.bilibili.com/video/B ... 145ded3c6f58c7e8d37
  1. <CommandMethod("TcTxtDaoXu")>
  2.     Public Sub TcTxtDaoXu()
  3.         On Error Resume Next
  4.         Dim acDc As Document = Application.DocumentManager.MdiActiveDocument
  5.         Dim acDb As Database = acDc.Database
  6.         Dim acTypValAr(0) As TypedValue
  7.         acTypValAr.SetValue(New TypedValue(DxfCode.Start, "TEXT"), 0)
  8.         Dim acSelFtr As SelectionFilter = New SelectionFilter(acTypValAr)
  9.         Dim acSSPrompt As PromptSelectionResult = acDc.Editor.GetSelection(acSelFtr)
  10.         If acSSPrompt.Status = PromptStatus.OK Then '选择成功
  11.             Dim acSS As SelectionSet = acSSPrompt.Value
  12.             For Each id As ObjectId In acSS.GetObjectIds
  13.                 Using acTrans As Transaction = acDb.TransactionManager.StartTransaction()
  14.                     Dim acTxt As DBText = acTrans.GetObject(id, OpenMode.ForWrite)
  15.                     Dim str As String = acTxt.TextString
  16.                     Dim strArr As Char() = str.ToCharArray
  17.                     Array.Reverse(strArr)
  18.                     Dim NewStr As New String(strArr)
  19.                     acTxt.TextString = NewStr
  20.                     acTrans.Commit()
  21.                 End Using
  22.             Next
  23.         End If
  24.     End Sub



发表于 2024-5-26 14:44 | 显示全部楼层
这不是镜像吗?
 楼主| 发表于 2024-5-26 15:10 | 显示全部楼层
不是,镜像要能从右往左,每个字就又反了
发表于 2024-5-27 06:43 | 显示全部楼层
tiancao100 发表于 2024-5-26 15:10
不是,镜像要能从右往左,每个字就又反了

什么情况下能用到这种功能

评分

参与人数 1明经币 +1 收起 理由
蓦然语嫣 + 1 我也想知道

查看全部评分

发表于 2024-5-27 07:22 | 显示全部楼层
不知怎么用
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-6-18 21:54 , Processed in 0.139393 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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