help with dictionaries...

Discussion in 'AutoCAD' started by Devin, Jan 30, 2004.

  1. Devin

    Devin Guest

    I just want to store values in a dictionary and then retrieve them later.
    Is there a simple way to do it? I'm kinda lost with the object classes.
    Any help would be great.

    Thanks,

    Devin
     
    Devin, Jan 30, 2004
    #1
  2. Devin

    Devin Guest

    Active X please. I think maybe I need to use xrecords but I'm new to using
    active x and xrecords. Any help would be greatly appreciated.

    Devin
     
    Devin, Jan 30, 2004
    #2
  3. Maybe this will help get you started.


    (setq *acad* (vlax-get-acad-object))
    (setq *doc* (vla-get-activedocument *acad*))


    ; add a dictionary
    (setq dict (vla-add (vla-get-dictionaries *doc*) "MyNewDictionary"))

    ; add an xrecord
    (setq xrec (vla-addxrecord dict "MyNewXrecord"))


    ; add data to the xrecord
    (vla-setxrecorddata
    xrec
    (vlax-safearray-fill
    (vlax-make-safearray
    vlax-vbinteger
    (cons 0 (1- (length '(1 2 3))))
    )
    '(1 2 3)
    )

    (vlax-safearray-fill
    (vlax-make-safearray
    vlax-vbvariant
    (cons 0 (1- (length '("a" "b" "c"))))
    )
    '("a" "b" "c")
    )
    )


    ; get data from the xrecord
    (vla-getxrecorddata xrec 'types 'values)
    (if (and types values)
    (mapcar
    'cons
    (vlax-safearray->list types)
    (mapcar 'vlax-variant-value (vlax-safearray->list values))
    )
    )
     
    Jason Piercey, Jan 30, 2004
    #3
  4. Devin

    Devin Guest

    Jason,

    I think I understand, and please correct me if I'm wrong. The first array in
    the (vla-setXdata type data) is the dxf codes and the second array is the
    values assigned to those dxf codes?
     
    Devin, Jan 30, 2004
    #4
  5. Yes. Depending on the type of values, you need to
    use specific dxf codes. In the developer help file
    search for "Group Codes - ranges of"
     
    Jason Piercey, Jan 30, 2004
    #5
  6. Devin

    Devin Guest

    Thanks Jason! As always you're a big help.

    Devin
     
    Devin, Jan 30, 2004
    #6
  7. Glad I could help, Devin.
     
    Jason Piercey, Jan 30, 2004
    #7
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.