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

Curve.GetDistanceAt(Point3d) eInvalidInput exception

156 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 (151 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)



Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.