Hi,
I'm trying to get the distance of a PLINE pickpoint from the start of the PLINE. I'm trying to us the Curve.GetDistanceAt(Point3d) method to accompliche the job (see code below). The code throws an eInvalidInput exception. Why?
Any thoughts?
The Poit3d argument is the pickpoint of the PLINE.
private double CurvePickPointDistance(ObjectId objectId, Point3d point3d)
{
double distance = 0;
using (Transaction transaction = Acad.Transaction)
{
try
{
using (Curve polyLine = (Curve) transaction.GetObject(objectId, OpenMode.ForRead))
{
distance = polyLine.GetDistAtPoint(point3d);
}
}
catch (Exception e) {}
}
return distance;
}
I don't think the pickpoint is necessarily on the actual polyline itself. You can find the closest point using the polyline's method GetClosestPointTo(pickedpoint, True)
-Mark