[CommandMethod("GetSelection")]
public void GetSelection()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
if (doc == null) return;
Editor ed = doc.Editor;
SelectionFilter filter =
new SelectionFilter (
new TypedValue[] {
new TypedValue((int)DxfCode.Start, "LINE,ARC,*POLYLINE")
}
);
PromptSelectionOptions opt = new PromptSelectionOptions();
opt.MessageForAdding = "Выберите отрезки, дуги и полилинии:";
opt.MessageForRemoval = "Удалите отрезки, дуги и полилинии:";
// ed.PromptingForSelection += ed_PromptingForSelection;
PromptSelectionResult res = ed.GetSelection(opt, filter);
// ed.PromptingForSelection -= ed_PromptingForSelection;
if (res.Status == PromptStatus.OK)
{
ed.WriteMessage("\nВыбрали {0} объектов", res.Value.Count);
}
}
[CommandMethod("GetMenu")]
public void GetMenu()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
if (doc == null) return;
Editor ed = doc.Editor;
PromptKeywordOptions opt =
new PromptKeywordOptions("\nВыберите число [Один/Два/Три]: ", "Один Два Три");
PromptResult res = ed.GetKeywords(opt);
if (res.Status == PromptStatus.OK)
{
ed.WriteMessage("\nВыбрали: {0}", res.StringResult);
}
}