using collection for more than one parameter

Discussion in 'AutoCAD' started by fischer, Sep 25, 2004.

  1. fischer

    fischer Guest

    i got a set of data. x,y,z coordinate and an identifier text string.

    i created a collection

    Dim liste_text As New Collection

    liste_text.Add nokta(0), yazi 'x coordinate of the text string.

    how am i gonna add the nokta(1) and nokta(2) to that collection.

    any idea?
    thnx.
     
    fischer, Sep 25, 2004
    #1
  2. Concantenate them together ->
    Dim s As String
    s = CStr(1.0) & "|" & CStr(1.0) & "|" & CStr(0.0)
    then add to the collection. When you need to use them, split them back
    apart.

    -- Mike
    ___________________________
    Mike Tuersley
    CADalyst's CAD Clinic
    Rand IMAGINiT Technologies
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Sep 25, 2004
    #2
  3. fischer

    Jürg Menzi Guest

    Hi fischer

    You can add a point array to the collection:

    liste_text.Add nokta, yazi

    Cheers
     
    Jürg Menzi, Sep 25, 2004
    #3
  4. fischer

    fischer Guest

    if id like create a list in a loop just like in autolisp - the "list"
    command.

    do i have to use arrays or collection sets. which one is better for
    manipulating. id like to add/remove/call this list item outside the loop.

    thnx.

    ps : i added the point array but could not call back with

    a=liste_text.item (yazi)
     
    fischer, Sep 26, 2004
    #4
  5. fischer

    fischer Guest

    Dim a, b
    b = Array()
    for .....
    yazi = sset.Item(i).TextString
    nokta = sset.Item(i).InsertionPoint 'insertion points of texts selected
    from model space
    noktax = CStr(nokta(0))
    noktay = CStr(nokta(1))
    noktaz = CStr(nokta(2))
    a = Array(yazi, noktax, noktay, noktaz)
    b = join(a)
    next ........
    debug.print b(n) 'n any number that is between 0 and ubound(b)

    i got nothing.
     
    fischer, Sep 26, 2004
    #5
  6. fischer

    Jürg Menzi Guest

    Hi fischer

    Sample 1:
    Code:
    Sub Sample1()
    
    Dim Col As New Collection
    Dim Pnt(0 To 2) As Double
    
    Pnt(0) = 1#
    Pnt(1) = 2#
    Pnt(2) = 3#
    
    Col.Add Pnt, "First"
    
    Debug.Print Col.Item("First")(0)
    Debug.Print Col.Item("First")(1)
    Debug.Print Col.Item("First")(2)
    
    End Sub
    
    Sample 2:
    Code:
    Sub Sample2()
    
    Dim Col As New Collection
    Dim Pnt(0 To 3) As Variant
    
    Pnt(0) = "First"
    Pnt(1) = 1#
    Pnt(2) = 2#
    Pnt(3) = 3#
    
    Col.Add Pnt
    
    Debug.Print Col.Item(1)(0)
    Debug.Print Col.Item(1)(1)
    Debug.Print Col.Item(1)(2)
    Debug.Print Col.Item(1)(3)
    
    End Sub
    
    Cheers
     
    Jürg Menzi, Sep 26, 2004
    #6
  7. fischer

    fischer Guest

    got it thnx alot.
    muy bueno.
    vielen dank.
     
    fischer, Sep 26, 2004
    #7
  8. fischer

    Jürg Menzi Guest

    Hi fischer

    Welcome...
    Je vous enprie...
    Gern geschehen...

    Cheers...¦-)
     
    Jürg Menzi, Sep 27, 2004
    #8
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.