I'm probably missing something simple here but is there a way to trap the enter key in a while loop for picking points without resorting to trapping windows messages?? I've tried all sorts of combinations and PromptStatus results to no avail.
Here's some simple code to start with that seems like it should work:
[CommandMethod("POINTS")]
public static void GetPoints()
{
Editor ed =
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
Point3dCollection coll = new Point3dCollection();
int count = 0;
bool picking = true;
while(picking)
{
PromptPointResult res = ed.GetPoint("\nSelect point:" + count);
if (res.Status == PromptStatus.Cancel)
{
return;//exit function all together!
}
if(res.Status != PromptStatus.OK)
{
picking = false;//anything to get out of here and keep my previous points!
}
else //all's still ok so add the point:
{
count++;
coll.Add(res.Value);//add point to collection
}
}
//Print out the points:
for(int i = 0;i < coll.Count;i++)
{
ed.WriteMessage("\nPoint {0} = {1}", i, coll[i].ToString());
}
}
tia,
Mick.