Results 1 to 2 of 2

Thread: Browsing BlockReferences

  1. #1
    Member
    Join Date
    2013-10
    Posts
    28
    Login to Give a bone
    0

    Question Browsing BlockReferences

    Why "red line" generates

    Run-time error '19':
    Type Mismatch

    Is there a way to browse only through BlockReferences, not all entities in drawing ?
    And I do not need & want Selection Set.

    Sub Test()
    Dim blkRef As AcadBlockReference
    For Each blkRef In ThisDrawing.ModelSpace
    ThisDrawing.Utility.Prompt blkRef.Name & vbCrLf
    Next
    End Sub

  2. #2
    Active Member
    Join Date
    2012-11
    Location
    Italy
    Posts
    65
    Login to Give a bone
    0

    Default Re: Browsing BlockReferences

    I guess it's because ModelSpace is not the collection of BlockReferences only.
    and on the other hand you can't use ThisDrawing.Blocks collection, since you're interested in BlockReferences
    so to avoid selectionset methods I'd use the following:

    Code:
    Sub Test()
    Dim blkRef As AcadBlockReference
    Dim acdEnt As AcadEntity
    For Each acdEnt In ThisDrawing.ModelSpace
        If TypeOf acdEnt Is AcadBlockReference Then
            Set blkRef = acdEnt
            ThisDrawing.Utility.Prompt blkRef.Name & vbCrLf
        End If
    Next acdEnt
    End Sub

Similar Threads

  1. 2005: Multiple blockreferences in 1 block
    By CADfunk MC in forum AutoCAD General
    Replies: 6
    Last Post: 2013-07-24, 02:58 PM
  2. Browsing for a Folder
    By spencer.67965 in forum VBA/COM Interop
    Replies: 11
    Last Post: 2011-05-11, 08:10 AM
  3. Using BlockReferences for Inner Loops of Hatch
    By lambwill in forum VBA/COM Interop
    Replies: 8
    Last Post: 2009-09-28, 09:45 AM
  4. BlockReferences with C# and objectDBX
    By ivan.markov in forum Dot Net API
    Replies: 13
    Last Post: 2007-06-19, 05:59 PM
  5. browsing
    By lila in forum Revit Architecture - General
    Replies: 0
    Last Post: 2007-03-02, 04:41 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •