如下图:根据提示选择若干图形要素,空格或右键结束选择,返回图元的objectid,以便进一步操作图元实体。
代码如下:
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using System.Collections.Generic;
using Autodesk.AutoCAD.ApplicationServices;
namespace sc
{
public class Class1
{
public static ObjectId GetEntity(string message)
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptEntityOptions po = new PromptEntityOptions(message);
PromptEntityResult pr = ed.GetEntity(po);
return pr.ObjectId;
}
public static List<ObjectId> SelectEntities(s