Author Topic: Extension dictionary and UNDO  (Read 1847 times)

0 Members and 1 Guest are viewing this topic.


  • Bull Frog
  • Posts: 448
Extension dictionary and UNDO
« on: November 07, 2013, 09:41:54 AM »
Not sure how to handle this, but reading the docs implies that the UNDO command could completely trash my application and this is indeed the case :(
Quote from: docs on DBDictionary.SetAt Method
This function adds a new entry specified by newValue into the dictionary, if searchKey does not already exist in the dictionary. If the entry with key searchKey already exists, the existing entry is erased, the dictionary is removed from its reactor list, and it is replaced by the newValue object is added to the dictionary in its place. The name of the object is specified by searchKey. The object's objectId entry is returned.

The UNDO command does not restore the data of the Xrecord in your dictionary after you have used the SetAt() method. You would find that the Xrecord is deleted after an UNDO command.

I store data in an extension dictionary under a given name which previously held some value

Code - C#: [Select]
  1.                 Xrecord revPrev = new Xrecord();
  2.                 revPrev.Data = new ResultBuffer(new TypedValue[2] { new TypedValue((int)DxfCode.Text, Revision.RevName), new TypedValue((int)DxfCode.Int32, (int)Revision.RevType) });
  3.                 if (!revDict.IsWriteEnabled) revDict.UpgradeOpen();
  4.                 revDict.SetAt(RevPrevious, revPrev);
  5.                 tr.AddNewlyCreatedDBObject(revPrev, true);

so that I can find it later

Code - C#: [Select]
  1.  DBDictionary revDict;
  2.                 if (db.GetCreateRevDict(out revDict))
  3.                 {
  4.                     string value = ((Xrecord)tr.GetObject(revDict.GetAt(RevPrevious), OpenMode.ForRead)).Data.AsArray()[0].Value.ToString();

but after undo it is not reverted to its previous value, it is deleted.  I suspect I'll need to throw a reactor onto the entry and watch for its erase so I can add the previous one (or something) has anybody dealt with this issue before?


  • Bull Frog
  • Posts: 448
Re: Extension dictionary and UNDO
« Reply #1 on: November 07, 2013, 09:46:40 AM »
nvm I'm retarded

writing this post made me think differently about my google keywords