Create Entity on Given Layout of External Drawing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I've narrowed down a question I had in another thread, apologies if it seems like I'm spamming the forum...
Whenever I insert -any- new object into a specific layout BlockTableRecordId, the entire layout seems to become that object. In other words, it seems like I am replacing the BlockTableRecord belonging to that Layout with my appended object.
Here is my code that pertains to getting the layout and appending the circle:
BlockTableRecord paperSpace = null;
DBDictionary layouts = (DBDictionary)externalTransaction.GetObject(externalDatabase.LayoutDictionaryId, OpenMode.ForRead);
foreach (DBDictionaryEntry layout in layouts)
{
Layout externalLayout = (Layout)externalTransaction.GetObject(layout.Value, OpenMode.ForRead);
if (destinationLayout.LayoutName != "Model" && destinationLayout.TabOrder == 1)
{
paperSpace = (BlockTableRecord)externalTransaction.GetObject(externalLayout.BlockTableRecordId, OpenMode.ForRead);
}
}
using(Circle circle = new Circle())
{
circle.SetDatabaseDefaults();
circle.Radius = 5;
circle.Center = new Point3d(2, 3, 0);
paperSpace.UpgradeOpen();
paperSpace.AppendEntity(circle);
externalTransaction.AddNewlyCreatedDBObject(circle, true);
}
Now in this situation the first paper space layout tab in my external drawing will just be that circle, with the page border graphics behind it. I'm sorry but I can't explain it any better, it's just weird.
Any help would be greatly appreciated.
Link copied