private static void RemoveVertexFromCurrentWipeout(ObjectId wipeoutId) { var doc = Application.DocumentManager.MdiActiveDocument; var ed = doc.Editor; var loop = true; while (loop) { using (doc.LockDocument()) { using (var tr = doc.TransactionManager.StartTransaction()) { var wipeout = tr.GetObject(wipeoutId, OpenMode.ForWrite) as Wipeout; if (wipeout != null) { var points3D = wipeout.GetVertices(); if (points3D.Count > 3) { var polyline = new Polyline(); for (var i = 0; i < points3D.Count; i++) { polyline.AddVertexAt(i, new Point2d(points3D[i].X, points3D[i].Y), 0.0, 0.0, 0.0); } var pickedPt = ed.GetPoint($"\n{Language.GetItem(LangItem, "msg22")}:"); if (pickedPt.Status != PromptStatus.OK) { loop = false; } else { var pt = polyline.GetClosestPointTo(pickedPt.Value, false); var param = polyline.GetParameterAtPoint(pt); var vertex = Convert.ToInt32(Math.Truncate(param)); polyline.RemoveVertexAt(vertex); var new2DPoints = new Point2dCollection(); for (var i = 0; i < polyline.NumberOfVertices; i++) { new2DPoints.Add(polyline.GetPoint2dAt(i)); } wipeout.SetFrom(new2DPoints, polyline.Normal); } } else { // message loop = false; } } tr.Commit(); } } } }
protected override bool WorldDraw(WorldDraw draw) { //draw.Geometry.Draw(myline); for (int i = 0; i < pts.Count; i++) { if (mypl.NumberOfVertices > i) { mypl.SetPointAt(i, pts[i]); } else { mypl.AddVertexAt(i, pts[i], 0, 0, 0); } } while (pts.Count < mypl.NumberOfVertices) { mypl.RemoveVertexAt(pts.Count - 1); } draw.Geometry.Draw(mypl); return(true); }