add the array to the AcadSelectionSet is zero - why?

Discussion in 'AutoCAD' started by Hartmut Callies, Jul 9, 2003.

  1. Hallo,
    I have two selectionsets. The first is for the user to select blocks on
    screen. The second
    selectionset with the objects from the block is for me.
    Why is the AcadSelectionSet "SSetForMe" zero? What is not correct?
    What must I change?

    Thanks.

    Hartmut Callies



    Dim SSetUser As AcadSelectionSet
    Dim SSetForMe As AcadSelectionSet
    Dim object as AcadEntity
    Dim objBlockRef As AcadBlockReference
    Dim objBlock As AcadBlock
    Dim objInBlock As AcadEntity
    Dim objInBlockArray As AcadEntity


    Set SSetUser = ThisDrawing.SelectionSets.Add("SSET1")
    Set SSetForMe = ThisDrawing.SelectionSets.Add("SSET2")

    SSetUser.SelectOnScreen

    Select Case object.ObjectName
    Case "AcDbBlockReference"
    For Each objBlockRef In SSetUser 'all blocks from
    SSetUser
    Set objBlock = ThisDrawing..Blocks.Item(objBlockRef.name)
    i=0
    For Each objInBlock In objBlock 'all entities from
    the block
    Redim Preserve objInBlockArray(0 to i)
    Set objInBlockArray(i) = objInBlock 'entity in a array
    i = i +1
    Next objInBlock

    'test
    For i = LBound (objInBlockArray) To UBound (objInBlockArray)
    Debug.Print objInBlockArray.ObjectName
    'test is ok
    Next i

    SSetForMe.AddItems objInBlockArray 'add the array to the
    AcadSelectionSet
    Next objBlockRef
    End Select

    Debug.Print SSetForMe.Count
    'why is this zero ???
     
    Hartmut Callies, Jul 9, 2003
    #1
  2. A selection set is used to hold a collection of objects that are selectable
    from the graphics window in normal use (even up to the point of selecting
    everything in the drawing). You *cannot* make a selection set of the Block
    object's own objects, as they don't exist onscreen (after all, a block may
    be defined and not inserted!).

    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | Thank you. But I cannot make a selection set of a block's objects? The
    array
    | with the objects from the block is a type AcadEntity. And entity I can add
    | to the selection set?
    |
    | Hartmut Callies
    |
    | ______________________________________________________________
    |
    | | > You cannot make a selection set of a block's objects.
    | >
    | >
    | > --
    | > R. Robert Bell, MCSE
    | > www.AcadX.com
    | >
    | >
    | > | > | Hallo,
    | > | I have two selectionsets. The first is for the user to select blocks
    on
    | > | screen. The second
    | > | selectionset with the objects from the block is for me.
    | > | Why is the AcadSelectionSet "SSetForMe" zero? What is not correct?
    | > | What must I change?
    | > |
    | > | Thanks.
    | > |
    | > | Hartmut Callies
    | > |
    | > |
    | > |
    | > | Dim SSetUser As AcadSelectionSet
    | > | Dim SSetForMe As AcadSelectionSet
    | > | Dim object as AcadEntity
    | > | Dim objBlockRef As AcadBlockReference
    | > | Dim objBlock As AcadBlock
    | > | Dim objInBlock As AcadEntity
    | > | Dim objInBlockArray As AcadEntity
    | > |
    | > |
    | > | Set SSetUser = ThisDrawing.SelectionSets.Add("SSET1")
    | > | Set SSetForMe = ThisDrawing.SelectionSets.Add("SSET2")
    | > |
    | > | SSetUser.SelectOnScreen
    | > |
    | > | Select Case object.ObjectName
    | > | Case "AcDbBlockReference"
    | > | For Each objBlockRef In SSetUser 'all blocks
    from
    | > | SSetUser
    | > | Set objBlock = ThisDrawing..Blocks.Item(objBlockRef.name)
    | > | i=0
    | > | For Each objInBlock In objBlock 'all
    entities
    | > from
    | > | the block
    | > | Redim Preserve objInBlockArray(0 to i)
    | > | Set objInBlockArray(i) = objInBlock 'entity in a
    | > array
    | > | i = i +1
    | > | Next objInBlock
    | > |
    | > | 'test
    | > | For i = LBound (objInBlockArray) To UBound
    (objInBlockArray)
    | > | Debug.Print objInBlockArray.ObjectName
    | > | 'test is ok
    | > | Next i
    | > |
    | > | SSetForMe.AddItems objInBlockArray 'add the array
    to
    | > the
    | > | AcadSelectionSet
    | > | Next objBlockRef
    | > | End Select
    | > |
    | > | Debug.Print SSetForMe.Count
    | > | 'why is this zero ???
    | > |
    | > |
    | >
    | >
    |
    |
     
    R. Robert Bell, Jul 16, 2003
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.