Community
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<BillZndl> wrote in messageI'm
href="news:6162517@discussion.autodesk.com">news:6162517@discussion.autodesk.com...
following some of Keans methods for adding entities to a BTR. At runtime, it
crashes at the record.ApppendEntity(ent); The program is creating the block
okay, but the block is empty. I'm selecting enties from the AutoCAD screen
using: PromptSelectionOptions posel = new PromptSelectionOptions();
posel.AllowDuplicates = false; PromptSelectionResult selres =
editor.GetSelection(posel); I've attached the entire class in a txt file. This
is the part I'm having trouble with. Do I have to change the entity to a COM
object? { BlockTableRecord record = new BlockTableRecord(); record.Name =
blkName; record.Origin = new Point3d(0, 0, 0); ObjectId[] objIds =
selres.Value.GetObjectIds(); foreach (ObjectId objId in objIds) { DBObject obj
= transaction.GetObject(objId, OpenMode.ForRead); Entity ent = (Entity)obj;
editor.WriteMessage("\nType: " + ent.GetType().ToString());
record.AppendEntity(ent); //***crashes here***.
transaction.AddNewlyCreatedDBObject(ent, true); //obj.Dispose(); }
table.Add(record); transaction.AddNewlyCreatedDBObject(record, true);
transaction.Commit(); TIA Bill