Message 1 of 3
When using AttachXref api, received following message AutoCAD message - Warning: an error ocurred during Save
Not applicable
06-04-2021
07:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
As mentioned in the title, when I try to attach an X-ref layer to my Drawing file, received the following error:
But, I am able to save the drawing successfully. Is there any way how to adress the above error. Following is my code snippet for attaching Xref:
using (Transaction tr = destDb.TransactionManager.StartTransaction())
{
ObjectId XrefID = destDb.AttachXref(filepath1, filepath);
BlockReference bref = new BlockReference(Point3d.Origin, XrefID);
BlockTable table = tr.GetObject(destDb.BlockTableId, OpenMode.ForWrite) as BlockTable;
BlockTableRecord ms1 = tr.GetObject(table[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
ms1.AppendEntity(bref);
tr.AddNewlyCreatedDBObject(bref, true);
LayerTable acLyrTbl;
acLyrTbl = tr.GetObject(destDb.LayerTableId, OpenMode.ForRead) as LayerTable;
if (acLyrTbl.Has("G-XREF"))
bref.Layer = "G-XREF";
tr.Commit();
}
Thanks,
Ranjan