New Member
Posts: 1
Registered: ‎03-14-2012
Message 1 of 2 (146 Views)

Curve.GetDistanceAt(Point3d) eInvalidInput exception

146 Views, 1 Replies
03-14-2012 07:01 AM


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)




    using (Curve polyLine = (Curve) transaction.GetObject(objectId, OpenMode.ForRead))


     distance = polyLine.GetDistAtPoint(point3d);



   catch (Exception e) {}


 return distance;


Posts: 375
Registered: ‎06-27-2005
Message 2 of 2 (141 Views)

Re: Curve.GetDistanceAt(Point3d) eInvalidInput exception

03-14-2012 07:49 AM in reply to: Mikaza

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)



You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community