A simple question on XData, XRecord, Dictionary, ...
I have come out with these two snippets of code:
AcadEntity.UpgradeOpen()
' Append XRecord
Dim xRec As New Xrecord()
xRec.Data = New ResultBuffer(New TypedValue(DxfCode.Text, myString))
AcadEntity.CreateExtensionDictionary()
Dim myAcadEntXDict As DBDictionary = _
myTrans.GetObject(AcadEntity.ExtensionDictionary(), _
OpenMode.ForWrite, False)
myAcadEntXDict.SetAt("myData", xRec)
myTrans.AddNewlyCreatedDBObject(xRec, True)
AcadEntity.DowngradeOpen()
that I use to attach data to and entity, and:
Dim myObjIds As DatabaseServices.ObjectIdCollection = _
New DatabaseServices.ObjectIdCollection(mySS.GetObjectIds)
Dim bHasGtaDict As Boolean = True
Dim GtaXrec As Xrecord = Nothing
For Each myObjId As DatabaseServices.ObjectId In myObjIds
Dim myAcadEnt As DatabaseServices.Entity = myObjId.GetObject(OpenMode.ForRead)
Try
Dim GtaXDict As DBDictionary = myTrans.getobject(myAcadEnt.ExtensionDictionary(), OpenMode.ForRead, False)
GtaXrec = myTrans.getobject(GtaXDict.GetAt("myData"), OpenMode.ForRead, False)
Catch
bHasGtaDict = False
End Try
If bHasGtaDict Then
Dim resBuf() As TypedValue = GtaXrec.Data.AsArray()
End If
Next
that I use to retrieve the same data from my ent.
I know that with
xRec.Data = New ResultBuffer(New TypedValue(DxfCode.Text, myString1), New TypedValue(DxfCode.Text, myString2))
I can add many different types of data to my entity, and that it can be of different types.
Now since I want to append different data to the entity in different working (drafting) sessions, and that, depending on the contest I'm working with the drawing, I will be updating this data, can anybody explain me the following:
1. Can I append more than one Xrecord to one Entity or can an Entity have more than one Xrecord...
2. ... if not, can I update the Xrecord data or am I supposed to retrieve the data, update it and then reattach it.
Thanks in advance for any help
René