-
- [CommandMethod("tt")]
- public void tt()
- {
- Document doc = Autodesk..ApplicationServices.Application.DocumentManager.MdiActiveDocument;
- Database db = HostApplicationServices.WorkingDatabase;
- Editor ed = doc.Editor;
- PromptEntityOptions enOpts = new PromptEntityOptions("选择一个多段线");
- PromptEntityResult enRes = ed.GetEntity(enOpts);
- if (enRes.Status == PromptStatus.OK)
- {
- //绘图事物
- using (Transaction trans = db.TransactionManager.StartTransaction())
- {
- Entity en = (Entity)trans.GetObject(enRes.ObjectId, OpenMode.ForRead);
- if (en is Polyline)
- {
- Polyline pl = (Polyline)en;
- int pts_len = pl.NumberOfVertices;
- for (int i = 0; i
- /// 获取多段线的顶点
- ///
- /// 多段线对象
- public static Point3dCollection GetPolyPoints(this Polyline pline)
- {
- Point3dCollection pts = new Point3dCollection();
- int i;
- for (i = 0; i < pline.NumberOfVertices; i++)
- {
- Point3d pt = pline.GetPoint3dAt(i);
- pts.Add(pt);
- }
- return pts;
- }
|