Perhaps you've been bitten by the horrible documentation.
The docs for SelectLast says it 'Selects last result from the prompt', which
is complete nonsense.
SelectLast returns the last object created in the current space, which has
nothing to do with the object that was edited by a command.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010
http://www.acadxtabs.com
Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");
wrote in message
news:6270178@discussion.autodesk.com...
I have added an Event Handler to the Document Editor that contains the code
below.
If I go to any block inserted in the drawing and double-click on it, the
EATTEDIT command is launched (as defined in the CUI for the Double Click
Action on an Attribute Block) but the ObjectId returned is always the same.
It never changes when a different object is selected.
If I hilight the block first, then right-click(select the right mouse
button) the code returns the correct ObjectID every time.
How do I get it to return the correct ObjectID in all cases?
I really cannot redefine the EATTEDIT command and its dbl-click action.
[Code]
private void callback_CommandEnded(Object o, CommandEventArgs e)
{
//Set up a reference to the AutoCAD editor
Autodesk.AutoCAD.EditorInput.Editor Ed =
AcadApp.DocumentManager.MdiActiveDocument.Editor;
//Case out the current AutoCAD command
switch (e.GlobalCommandName)
{
case "EATTEDIT":
PromptSelectionResult lastRes = Ed.SelectLast();
if (lastRes.Value != null && lastRes.Value.Count ==
1)
{
Ed.WriteMessage("\nEntity is: " +
lastRes.Value);
}
break;
}
}
Output:
Double-Click on Block A:
Select a block: 47.246932,11.307365,0.000000
Entity is: (((2129775720),NonGraphical,0,))
Double-Click on Block B:
Select a block: 40.840972,13.998628,0.000000
Entity is: (((2129775720),NonGraphical,0,))
Select block A, then Right-click:
Select a block: 47.246932,11.307365,0.000000
Entity is: (((2129775720),NonGraphical,0,))
Select block B, then Right-click:
Select a block: 40.840972,13.998628,0.000000
Entity is: (((2129775176),PickPoint,0,))
Edited by: lial.williams@arnold.af.mil on Oct 12, 2009 4:20 PM