乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 13|回复: 0

固定标注值并改变标注颜色出现的新问题

[复制链接]

19

主题

45

帖子

5

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
121
发表于 2006-4-19 16:44:00 | 显示全部楼层 |阅读模式
Private Sub CommandButton1_Click()
On Error GoTo Err_handle
    Dim FilterType(0) As Integer
    Dim FilterData(0) As Variant
    Dim point As Variant
    Me.Hide
   
    Set SSdim = ThisDrawing.SelectionSets.Add("S_t_dim")
        FilterType(0) = 0
        FilterData(0) = "DIMENSION"
        SSdim.SelectOnScreen FilterType, FilterData
    If SSdim.Count = 0 Then
        MsgBox "你没有选择标注,程序中止!", vbOKOnly
        ThisDrawing.SelectionSets.Item("S_t_dim").Delete
        End
    End If
    Dim EntityInBlock As AcadEntity
    Dim TextString As String
    Dim Sobj As AcadObject
    Dim BlkId As Double
   
    For Each Sobj In SSdim
        BlkId = Sobj.OwnerID
        TextString = "123"
        For Each EntityInBlock In ThisDrawing.ObjectIdToObject(BlkId)
            If EntityInBlock.ObjectName = "AcDbMText" Then
                TextString = EntityInBlock.TextString
                Exit For
            End If
        Next
        Sobj.TextOverride = TextString
        Sobj.TextColor = acYellow
    Next
   
        ThisDrawing.SelectionSets.Item("S_t_dim").Delete
   
    Exit Sub
Err_handle:
    If Err.Number = -2145320851 Then   '已经存在“S_t_dim”选集
        ThisDrawing.SelectionSets.Item("S_t_dim").Delete
        CommandButton1_Click
    End If
End Sub
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-5 15:47 , Processed in 0.523602 second(s), 54 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表