.NET

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

bt and btr

47 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"

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community