明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2124|回复: 4

请问,如何将图上所有的数字(成千上万个数值)减去同一个常数?

[复制链接]
发表于 2002-12-7 14:23 | 显示全部楼层 |阅读模式
发表于 2002-12-13 15:10 | 显示全部楼层

你指的是text吗?

 楼主| 发表于 2002-12-15 00:35 | 显示全部楼层

是的

发表于 2002-12-15 18:28 | 显示全部楼层

看看这段代码对你有没有用处。

这段程序提示你选择文本,然后指定增量,正的就是加,负的就是减了。如果选中的文本是数字的,那么就对它进行加或减处理。
Sub Test()
    Dim SSetObj As AcadSelectionSet
    Dim bFound As Boolean
    Dim IncreaseValue As Double
    Dim i As Integer
   
    On Error GoTo ErrTrap
    For Each SSetObj In ThisDrawing.SelectionSets
        If SSetObj.Name = "ChangeText" Then
            bFound = True
            Exit For
        End If
    Next
    If bFound = False Then
        Set SSetObj = ThisDrawing.SelectionSets.Add("ChangeText")
    Else
        Set SSetObj = ThisDrawing.SelectionSets("ChangeText")
        SSetObj.Clear
    End If
    SSetObj.SelectOnScreen
    If SSetObj.Count = 0 Then Exit Sub
    IncreaseValue = ThisDrawing.Utility.GetReal("指定数值增量: ")
    For i = 0 To SSetObj.Count - 1
        If TypeOf SSetObj(i) Is AcadText Or TypeOf SSetObj(i) Is AcadMText Then
            If IsNumeric(SSetObj(i).TextString) Then
                SSetObj(i).TextString = SSetObj(i).TextString + IncreaseValue
            End If
        End If
    Next
    SSetObj.Delete
    Set SSetObj = Nothing
    Exit Sub
   
ErrTrap:
    If Not (SSetObj Is Nothing) Then Set SSetObj = Nothing
    On Error GoTo 0
End Sub
 楼主| 发表于 2002-12-19 14:54 | 显示全部楼层

谢谢efan2000。

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-3 21:43 , Processed in 0.857832 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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