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

Xrecord Problem

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
323 Views, 2 Replies

Xrecord Problem

Hi all,
Please, can somebody tell me what is the problem with creating Xrecord in my following code:

Database db = HostApplicationServices.WorkingDatabase;
Transaction trans = db.TransactionManager.StartTransaction();
Xrecord XRec= new Xrecord();
XRec.Data=new ResultBuffer(
new TypedValue((int)DxfCode.Text,this.dsidtxt.Text),
new TypedValue((int)DxfCode.Text,this.tpcmb.Text),
new TypedValue((int)DxfCode.Text,this.catcmb.Text),
new TypedValue((int)DxfCode.Text,this.stcmb.Text));
this.entity.CreateExtensionDictionary();
DBDictionary extDict=(DBDictionary)trans.GetObject(this.entity.ExtensionDictionary,OpenMode.ForWrite,false);
extDict.SetAt("MyData");
trans.AddNewlyCreatedDBObject(XRec,true);
trans.Dispose();

the error which it gives me is:
INTERNAL ERROR: !dbobji.cpp@6266: eNotOpenForWrite

I am using Autocad 2006,VS2003,C#.

Thanks in advanc.

Noora
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Is the object which you are attaching the
extension dictionary to, open for write?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5252809@discussion.autodesk.com...
Hi all,
Please, can somebody tell me what is the problem with creating Xrecord in my following code:

Database db = HostApplicationServices.WorkingDatabase;
Transaction trans = db.TransactionManager.StartTransaction();
Xrecord XRec= new Xrecord();
XRec.Data=new ResultBuffer(
new TypedValue((int)DxfCode.Text,this.dsidtxt.Text),
new TypedValue((int)DxfCode.Text,this.tpcmb.Text),
new TypedValue((int)DxfCode.Text,this.catcmb.Text),
new TypedValue((int)DxfCode.Text,this.stcmb.Text));
this.entity.CreateExtensionDictionary();
DBDictionary extDict=(DBDictionary)trans.GetObject(this.entity.ExtensionDictionary,OpenMode.ForWrite,false);
extDict.SetAt("MyData");
trans.AddNewlyCreatedDBObject(XRec,true);
trans.Dispose();

the error which it gives me is:
INTERNAL ERROR: !dbobji.cpp@6266: eNotOpenForWrite

I am using Autocad 2006,VS2003,C#.

Thanks in advanc.

Noora
Message 3 of 3
Anonymous
in reply to: Anonymous

yes, this peace of code shows the creation of each object:

BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForWrite);
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
foreach (ObjectId id in btr)
{
Entity ent = (Entity)trans.GetObject(id, OpenMode.ForWrite, false);
MyObject ds=new MyObject(ent);
}
trans.Commit();
trans.Dispose();

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