C# Cad拾取多段线

/// 
/// 拾取多段线
/// 
/// 
public static Polyline GetPolyLine()
{
    Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;//core
    Polyline entPolyLine = null;
    using (Transaction ts = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction())
    {
        PromptEntityOptions peo = new PromptEntityOptions("选择多段线");
        peo.SetRejectMessage("对象必须是多段线!");
        peo.AddAllowedClass(typeof(Polyline), false);

        PromptEntityResult per = ed.GetEntity(peo);

        if (per.Status == PromptStatus.OK)
        {
            entPolyLine = (Polyline)ts.GetObject(per.ObjectId, OpenMode.ForRead);
        }
        ts.Commit();
    }
    return entPolyLine;
}

 

你可能感兴趣的:(C#,Cad)