Adding text data to a dictionary - is it possible?

Discussion in 'AutoCAD' started by Laurie Comerford, Mar 11, 2005.

  1. Hi,

    I'm looking at a means of storing text based data in a drawing and thought I
    could do it using a Dictionary.

    However, the help files only indicate you can store Objects defined in an
    ARX file, or Xdata.

    Should text be stored as Xdata in a dictionary? - that doesn't make sense to
    me.

    All suggestions welcome.

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Mar 11, 2005
    #1
  2. Hey Laurie,

    You can create a Dictionary and then store
    an XRecord in it which will accept data
    via group codes.

    ie...
    code(0) = 1001: data(0) = "test"

    I'll send an sample if needed.

    Paul
     
    Paul Richardson, Mar 11, 2005
    #2
  3. if anyone is interested here is a quick
    solution. Bit long in the tooth, could
    be condenced some.

    Sub setXrecord()
    Dim dict As AcadDictionary
    Dim record As AcadXRecord
    Dim dataType(0) As Integer: dataType(0) = 1001
    Dim dataValue(0): dataValue(0) = "Test"

    Set dict = ThisDrawing.Dictionaries.Add("Dict1")
    Set record = dict.AddXrecord("someData")

    record.SetXRecordData dataType, dataValue

    Set dict = Nothing
    End Sub

    Sub getXrecord()
    Dim dict As AcadDictionary
    Dim record As AcadXRecord
    Dim outData, outType

    Set dict = ThisDrawing.Dictionaries.Add("Dict1")

    Set record = dict.Item("someData")
    record.GetXRecordData outData, outType

    Debug.Print outData(0) & " " & outType(0)

    Set dict = Nothing
    End Sub
     
    Paul Richardson, Mar 11, 2005
    #3
  4. Laurie Comerford, Mar 11, 2005
    #4
  5. Your welcome...

    I'm sure it was just payback
    for something I got from
    you...
     
    Paul Richardson, Mar 11, 2005
    #5
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.