qiush1234 发表于 2015-10-12 15:40:39

mccad 发表于 2003-3-10 19:51 static/image/common/back.gif
Sub SelBlkSet()
    Dim Blk As AcadBlockReference
    Dim Ent As AcadEntity


Private Sub CommandButton1_Click()
    Dim Blk As AcadBlockReference
    Dim Ent As AcadEntity
    Dim Pnt As Variant
    Dim SelBlk As Boolean
    Dim BlkName As String
   
    On Error Resume Next
   
    '选择对象并判断所选对象是否为图块
    SelBlk = True
    While SelBlk
    ThisDrawing.Utility.GetEntity Ent, Pnt, "选择图块"
    If Ent.ObjectName = "AcDbBlockReference" Then
       Set Blk = Ent
      BlkName = Blk.Name
      SelBlk = False
    End If
    Wend
Debug.Print "选定的图块名称为“" & BlkName

End Sub


因为使用整段代码卡在了选择图块上,我是AUTOCAD2010版本的。
将代码简化为上面显示的,还是卡在了选择图块上。不知是啥问题?
页: 1 [2]
查看完整版本: vb\块\选择集