I was reading through the ObjectBrowser, ( as one does on a Saturday morning),
and this caught my eye.
public PromptSelectionResult SelectLast();
Declaring Type: Autodesk.AutoCAD.EditorInput.Editor
so I had a play.
The core of this could probably be wrapped and used as an alternative to P/Invokeing acdbEntLast().
This is pretty basic, but may be handy ..
sorry, no piccy ; you'll need to build it to see
// CodeHimBelongaKwb © Nov 2007
using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
[assembly: CommandClass(typeof(SelectLastTest.TestCommands))]
namespace SelectLastTest
{
public class TestCommands
{
[CommandMethod("SelectLast")]
static public void testSelectLast()
{
Document doc = AcadApp.DocumentManager.MdiActiveDocument;
PromptSelectionResult whatsLast = doc.Editor.SelectLast();
if (whatsLast.Value != null
&& whatsLast.Value.Count == 1)
{
AcadApp.ShowAlertDialog("\nEntlast ObjectID is: "
+ whatsLast.Value[0].ObjectId);
}
else
{
AcadApp.ShowAlertDialog("\nOooops Nothing to see ");
}
}
}
}