Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi;
simplification of multi-point drawn polyline
How do you remove the vertex from a polyline?
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Geometry;
namespace IterateObjects
{
public class Commands
{
[CommandMethod("PLN")]
static public void ListVertices()
{
Document doc Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
Database db = doc.Database;
PromptEntityResult per ed.GetEntity("Select a polyline");
if (per.Status == PromptStatus.OK)
{
Transaction tr = b.TransactionManager.StartTransaction();
using (tr)
{
DBObject obj = tr.GetObject(per.ObjectId, OpenMode.ForRead);
Polyline lwp = obj as Polyline;
if (lwp != null)
{
int vn = lwp.NumberOfVertices;
for (int i = 0; i < vn; i++)
{
Point2d pt = lwp.GetPoint2dAt(i);
}
// delete vertex
//How do you remove the vertex from a polyline?
}
tr.Commit();
}
}
}
}
}
Solved! Go to Solution.