Community
Hello All!
Please help me!
Why the xrecord not save?
public static void SaveInscCad(ObjectId idEnt, string InscCad) { Database db = AcadAppServices.Application.DocumentManager.MdiActiveDocument.Database; using (Transaction tr = db.TransactionManager.StartTransaction()) { try { Entity ent = (Entity)tr.GetObject(idEnt, OpenMode.ForWrite); if (ent.ExtensionDictionary.IsNull) ent.CreateExtensionDictionary(); DBDictionary extDic = (DBDictionary)tr.GetObject(ent.ExtensionDictionary, OpenMode.ForWrite); TypedValue[] valores = new TypedValue[1]; valores[0] = new TypedValue((int)DxfCode.Text, InscCad); ResultBuffer resBuf = new ResultBuffer(valores); Xrecord dado = new Xrecord(); dado.Data = resBuf; extDic.SetAt(InscCad, dado); tr.AddNewlyCreatedDBObject(dado, true); tr.Commit(); } catch (System.Exception) { tr.Abort(); } } }
Thanks...
Solved! Go to Solution.
Ran your code and it does work. an extension dictionary is added to the entity and holds the string. if you use MgdDbg you can see the record, you can ge MgdDbg from here http://through-the-interface.typepad.com/through_the_interface/2010/02/the-stephen-and-fenton-show-a...