Message 1 of 19
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Just hoping someone will review my code below and offer advice for improvements. Basically want to learn. Thanks!!!
// send wipeouts to back
namespace BCCWIPEBACK
{
public class DraftingTools
{
[CommandMethod("BCC:WBACK")]
public static void BCCWIPETOBACK()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Transaction tr = db.TransactionManager.StartTransaction();
using (tr)
{
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
foreach (ObjectId objId in bt)
{
BlockTableRecord btr = objId.GetObject(OpenMode.ForWrite) as BlockTableRecord;
foreach (ObjectId btrObjId in btr)
{
Entity ent = btrObjId.GetObject(OpenMode.ForWrite) as Entity;
if (ent is Wipeout)
{
DrawOrderTable drawOrder = tr.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
ObjectIdCollection ids = new ObjectIdCollection();
ids.Add(ent.ObjectId);
drawOrder.MoveToBottom(ids); //move the selected entity so that entity is drawn in the beginning of the draw order.
}
}
} tr.Commit();
}
}
}
}
"Very funny, Scotty. Now beam down my clothes.
Solved! Go to Solution.

