Dictionary Object

Discussion in 'AutoCAD' started by Phil Custer, May 19, 2004.

  1. Phil Custer

    Phil Custer Guest

    Does any one know where I can get an in depth discussion of the Dictionaries
    Collection
    and the Dictionary Object of a drawing. I would like to store VBA objects
    and data in
    the drawing but the online help if very limited.

    Thanks,
    Phil Custer, P.E.
     
    Phil Custer, May 19, 2004
    #1
  2. Phil,

    You will be unable to store VBA objects in AutoCAD's Dictionary object. Data
    is not a problem.

    After you create a Dictionary object in the Dictionaries collection, you add
    XRecord objects to that dictionary. You then add data to the XRecord,
    following the DXF conventions outlined in the DXF Guide (on-line help).

    Below is a sample of writing, then reading, some data from an XRecord.

    ' Written by: R. Robert Bell

    Public Sub WriteXRec()
    Dim myDict As AcadDictionary
    Set myDict = ThisDrawing.Dictionaries.Add("Sample")

    Dim myXRec As AcadXRecord
    Set myXRec = myDict.AddXRecord("Test")

    Dim dxfCode(0 To 1) As Integer
    Dim dxfData(0 To 1)
    dxfCode(0) = 1: dxfData(0) = "Hello?"
    dxfCode(1) = 2: dxfData(1) = "Is there anybody out there?"
    myXRec.SetXRecordData dxfCode, dxfData
    End Sub

    Public Sub ReadXRec()
    Dim myDict As AcadDictionary
    Set myDict = ThisDrawing.Dictionaries.Item("Sample")

    Dim myXRec As AcadXRecord
    Set myXRec = myDict.Item("Test")

    Dim dxfCode, dxfData
    myXRec.GetXRecordData dxfCode, dxfData

    MsgBox dxfData(0) & vbCrLf & dxfData(1)
    End Sub


    --
    R. Robert Bell


    Does any one know where I can get an in depth discussion of the Dictionaries
    Collection
    and the Dictionary Object of a drawing. I would like to store VBA objects
    and data in
    the drawing but the online help if very limited.

    Thanks,
    Phil Custer, P.E.
     
    R. Robert Bell, May 19, 2004
    #2
  3. Phil Custer

    Phil Custer Guest

    Thanks,
    A short explanation of the Dictionary object showing your example would be
    helpfull in the
    manual!!!
     
    Phil Custer, May 19, 2004
    #3
  4. Glad I could help.

    --
    R. Robert Bell


    Thanks,
    A short explanation of the Dictionary object showing your example would be
    helpfull in the
    manual!!!
     
    R. Robert Bell, May 19, 2004
    #4
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.