public static void HighlightObject(string id)
{
doc = Application.DocumentManager.MdiActiveDocument;
db = doc.Database;
using (doc.LockDocument())
{
using (trans = db.TransactionManager.StartOpenCloseTransaction())
{
PromptSelectionResult getSel = doc.Editor.SelectAll();
if (getSel.Status == PromptStatus.OK)
{
SelectionSet selSet = getSel.Value;
foreach (SelectedObject selObj in selSet)
{
var entity = trans.GetObject(selObj.ObjectId, OpenMode.ForWrite) as Entity;
if (entity != null && entity.Id.ToString() == id)
{
entity.Highlight();
}
else
{
if (entity != null) entity.Unhighlight();
}
}
}
trans.Commit();
}
}
}