Message 1 of 1
Deleting Xrecord from dictionary does not change dwg size
Not applicable
12-28-2020
02:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I'm saving large data set in Xrecord. However when I deleted that Xrecord from the drawing the DWG size sometimes decreases to normal but mostly all of the time it's remain same (like it would be with saved Xrecord). So here's a sample of my code of deleting Xrecord:
public static bool DeleteXRecord(Document doc, string dictionaryName, string recordName)
{
Database db = doc.Database;
using (doc.LockDocument())
using (Transaction tr = db.TransactionManager.StartTransaction())
{
var nod = (DBDictionary)tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead);
if (!nod.Contains(dictionaryName))
{
tr.Commit();
return false;
}
var dict = (DBDictionary)tr.GetObject(nod.GetAt(dictionaryName), OpenMode.ForRead);
if (dict == null || !dict.Contains(recordName))
{
tr.Commit();
return false;
}
dict.UpgradeOpen();
var xRecord = (Xrecord)tr.GetObject(dict.GetAt(recordName), OpenMode.ForWrite);
dict.Remove(recordName);
xRecord.Erase();
tr.Commit();
return true;
}
}So I tried many different approaches but the result still the same. So I wondering if AutoCAD clearing itself after sometime or I missing something in my code because sometime DWG size is back to normal like I said. Any suggestions?