1
Blocks / Re: how can i redefine a block
« on: April 12, 2012, 03:57:32 PM »
What kind of changed do you want to make ?
On of the simplest change to a block is appending an entity to the ModelSpace Block, like so:
On of the simplest change to a block is appending an entity to the ModelSpace Block, like so:
Code: [Select]
[CommandMethod("drawline")]
static public void drawline()
{
Database db = HostApplicationServices.WorkingDatabase;
using (Transaction tr = db.TransactionManager.StartTransaction())
BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord ms = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
Line ln = new Line(new Point3d(10, 10, 0), new Point3d(20, 20, 0));
ms.AppendEntity(ln);
tr.AddNewlyCreatedDBObject(ln, true);
tr.Commit();
}
}
