I know how to do it now.
totu, thank you for your posting anyway.
Zhongwei Xia
"Zhongwei Xia" wrote in message
news:4884810@discussion.autodesk.com...
Hi,
I'm trying to insert a block with attributes into drawing file model spacel.
I can only see the block, and can't get the attributes inserted. I think I
need to loop check the block definition, find attribute definitions in it,
and insert these attributes.
Following is the code to do insert block:
Autodesk.AutoCAD.DatabaseServices.BlockReference blkRef = new
BlockReference(insPnt, blockID);
using (Transaction myT = tm.StartTransaction())
{
BlockTable bt =
(BlockTable)tm.GetObject(currentdb.BlockTableId,OpenMode.ForRead, false);
BlockTableRecord btr =
(BlockTableRecord)tm.GetObject(bt[BlockTableRecord.ModelSpace],OpenMode.ForWrite,false);
btr.AppendEntity(blkRef);
tm.AddNewlyCreatedDBObject(blkRef, true);
myT.Commit();
}
Thank you for any helps.
Zhongwei Xia