.NET

Reply
Contributor
supec
Posts: 19
Registered: ‎11-01-2006
Message 1 of 1 (51 Views)

bt and btr

51 Views, 0 Replies
11-01-2006 11:30 AM
acadDb.Database acadWorkingDB = acadDb.HostApplicationServices.WorkingDatabase;
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
acadDb.Transaction trans = acadWorkingDB.TransactionManager.StartTransaction();
try
{
acadDb.Circle circle = new acadDb.Circle(new acadGeom.Point3d(10, 10, 0), acadGeom.Vector3d.ZAxis, 2);
acadDb.BlockTable bt = (acadDb.BlockTable)trans.GetObject(acadWorkingDB.BlockTableId, acadDb.OpenMode.ForRead);
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(
HostApplicationServices.WorkingDatabase.CurrentSpaceId,
OpenMode.ForWrite);

btr.AppendEntity(circle);
trans.AddNewlyCreatedDBObject(circle, true);
trans.Commit();
}
catch
{
ed.WriteMessage("Error ");
}
finally
{
trans.Dispose();
}

And finally one question: Why is there declaration of bt? It isn't further used... And when I comment it out with //, nothing happens, code works as it did before... At least it seems so.

It's sample from "AutoCAD 2007 .NET API Training Labs"
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.