.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modifying an XRecord changes all xrecords in dictionary

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
SRSDS
677 Views, 2 Replies

Modifying an XRecord changes all xrecords in dictionary

Hi all,  This is really strange and I can't quite figure it out.

I have a dictionary in the NOD with several xrecords. I want to change an entry value in one but the others in the dictionary also get changed. How would they be connected?

This is some simlified code that looks at two xrecords, changes one, then reports the new values. Wierd thing is that both xrecords get changed.

 

        For i = 1 To 2
            XRecId = MyAppDict.GetAt(i)
            XRec = trans.GetObject(XRecId, OpenMode.ForRead)
            ed.WriteMessage(vbLf + "XRecord: " & i & " First Entry: " & XRec.Data(0).value)
        Next
        XRecId = MyAppDict.GetAt(2)
        XRec = trans.GetObject(XRecId, OpenMode.ForWrite)
        Dim data As ResultBuffer = New ResultBuffer(New TypedValue(DxfCode.Int16, 2), New TypedValue(DxfCode.Text, XRec.Data(1).value))
        XRec.Data = data
        For i = 1 To 2
            XRecId = MyAppDict.GetAt(i)
            XRec = trans.GetObject(XRecId, OpenMode.ForRead)
            ed.WriteMessage(vbLf + "XRecord: " & i & " First Entry: " & XRec.Data(0).value)
        Next

 

 

 

2 REPLIES 2
Message 2 of 3
Alfred.NESWADBA
in reply to: SRSDS

Hi,

 

try to do a trans.Commit (and create a new transaction) after modifying the data/before starting the loop testreading it.

To make it easier (less work) for us to test this, help us with uploading a drawing with your XRecords attached.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 3 of 3
SRSDS
in reply to: Alfred.NESWADBA

Thanks Alfred.

I committed the transaction but also removed the xrecord then replaced it in the next transaction.

Strange that it was doing that.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost