I want to delete the object data record of an entity.The following code can remove the entity's object data record,but when after the code excuted,I cann't do anything with the entity,it also says"the object was already open for write".If I close the dwg file and then open it,it works.Why this happens?Is it a bug of cadmap?
Thanks for any help! Sorry for my poor english!
AcadApplication acadApp = (AcadApplication)System.Runtime.InteropServices.Marshal.GetActiveObject ("AutoCAD.Application");
AutocadMAP.AcadMap map = (AcadMap)acadApp.GetInterfaceObject("AutoCADMap.Application");
AutocadMAP.Project p = map.Projects.Item(0);
AutocadMAP.ODRecords records = p.ODTables.GetODRecords();//
AutocadMAP.ODTable table = null;//
if (records.Init(selectEntity, true , false))//the second var must set to true to remove object data record
{
ODRecord removeRecord = records.Record();
records.Remove();
s = records.Init(selectEntity, false , false);
//close the entity,if don't excute this sentence,the program will give an error
records = null;}