明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1289|回复: 0

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

[复制链接]
发表于 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

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

本版积分规则

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

GMT+8, 2024-11-27 06:30 , Processed in 0.153860 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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