.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 1
supec
229 Views, 0 Replies

bt and btr

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"
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost