I don't recall doing one Jeff ..
So cobbled this together for fun.
It's a little vulgar but does the job.
filters can be added.
Perhaps a SelectCrossingPolygon would be better for a more circular selection
but it doesn't have a forceSubEntitySelection option
ie: public PromptSelectionResult SelectCrossingWindow(Point3d pt1, Point3d pt2, SelectionFilter filter, bool forceSubEntitySelection);
added: I work in metric so I've used 1 and -1 for the growth vectors ... fine tune o suit
// (C) CodeHimBelonga kdub@theSwamp 2010
//
using System;
using System.Windows.Forms;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.Runtime;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
[assembly
: CommandClass
(typeof(kdub_Testing
.SelectNearPoint))]
namespace kdub_Testing
{
public class SelectNearPoint
{
/// <summary>
///
/// </summary>
[CommandMethod("sel5")]
public void
Select05()
{
Point3d pointToTry
= new Point3d
(0.0,
0.0,
0.0); ObjectIdCollection stuff;
stuff = SelectSomewhereNearPoint(pointToTry);
if(stuff.Count >= 1) {
string desc = (stuff.Count == 1) ? " thingy." : " thingies.";
System.Windows.Forms.MessageBox.Show("we collected " + stuff.Count.ToString() + desc,
"Wheeeeeee",
MessageBoxButtons.OK,
MessageBoxIcon.Information
);
} else {
System.Windows.Forms.MessageBox.Show("You Made Boo-Boo Selection",
"Oooooops",
MessageBoxButtons.OK,
MessageBoxIcon.Hand
);
}
}
/// <summary>
///
/// </summary>
/// <param name="point"></param>
/// <returns></returns>
public static
ObjectIdCollection SelectSomewhereNearPoint(Point3d point)
{
Editor ed = AcadApp.DocumentManager.MdiActiveDocument.Editor;
Point3d ll = point;
Point3d ur = point;
Vector3d minus
= new Vector3d
(-1,
-1,
0); Vector3d plus
= new Vector3d
(1,
1,
0); PromptSelectionResult result;
result = ed.SelectCrossingWindow(ll, ur);
while(result.Status != PromptStatus.OK) {
ll = ll.Add(minus);
ur = ur.Add(plus);
result = ed.SelectCrossingWindow(ll, ur);
}
return new ObjectIdCollection
(result
.Value.GetObjectIds()); }
}
}