Skip to content

Instantly share code, notes, and snippets.

@chuongmep
Created July 5, 2020 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuongmep/c0e2e2acd5fc47d9fcb9308c3741d3ae to your computer and use it in GitHub Desktop.
Save chuongmep/c0e2e2acd5fc47d9fcb9308c3741d3ae to your computer and use it in GitHub Desktop.
[CommandMethod("GetSelection")]
public static void SelectionTest()
{
var ed = Application.DocumentManager.MdiActiveDocument.Editor;
var pso = new PromptSelectionOptions();
pso.SingleOnly = true;
pso.SinglePickInSpace = true;
PromptSelectionResult psr;
var ids = new ObjectIdCollection();
while (true)
{
psr = ed.GetSelection(pso);
if (psr.Status != PromptStatus.OK)
break;
ids.Add(psr.Value[0].ObjectId);
ed.WriteMessage("\n{0} selected objects", ids.Count);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment