I do not speak English,
I misunderstood what you want, I attached the modified code, where you calculate the distance between the points and the angle from the x axis.
No hablo ingles,
No he entendido bien lo que quieres, te adjunto el codigo modificado, donde te calcula la distancia entre los puntos y el angulo respecto al eje X.
Para la polyline3d haz algo parecido.
[CommandMethod("listaVertices")]
static public void ListVertices()
{
Document doc = Autodesk.AutoCAD.ApplicationServices.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 = db.TransactionManager.StartTransaction();
using (tr)
{
DBObject obj = tr.GetObject(per.ObjectId, OpenMode.ForRead);
// If a "lightweight" (or optimized) polyline
Polyline lwp = obj as Polyline;
if (lwp != null)
{
// Use a for loop to get each vertex, one by one
int vn = lwp.NumberOfVertices;
for (int i = 0; i < vn; i++)
{
// Could also get the 3D point here
Point2d pt = lwp.GetPoint2dAt(i);
ed.WriteMessage("\n" + pt.ToString());
Point2d pt2d;
if (i != 0)
{
double d =Math.Round(pt.GetDistanceTo(pt2d),2);
string s = d.ToString("\n" + "0.00" + " m.");
ed.WriteMessage(s);
double ang= pt2d.GetVectorTo(pt).Angle;
s = ang.ToString("\n" + "0.00");
ed.WriteMessage(s);
pt2d = pt;
}
else
{
pt2d= pt;
}
}
}
else
{
// If an old-style, 2D polyline
Polyline2d p2d = obj as Polyline2d;
if (p2d != null)
{
// Use foreach to get each contained vertex
foreach (ObjectId vId in p2d)
{
Vertex2d v2d = (Vertex2d)tr.GetObject(vId, OpenMode.ForRead);
ed.WriteMessage("\n" + v2d.Position.ToString());
}
}
else
{
// If an old-style, 3D polyline
Polyline3d p3d = obj as Polyline3d;
if (p3d != null)
{
// Use foreach to get each contained vertex
foreach (ObjectId vId in p3d)
{
PolylineVertex3d v3d = (PolylineVertex3d)tr.GetObject(vId, OpenMode.ForRead);
ed.WriteMessage("\n" + v3d.Position.ToString());
}
}
}
}
// Committing is cheaper than aborting
tr.Commit();
}
}
}