.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Curve.GetDistanceAt(Point3d) eInvalidInput exception

1 REPLY 1
Reply
Message 1 of 2
Mikaza
395 Views, 1 Reply

Curve.GetDistanceAt(Point3d) eInvalidInput exception

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;

}

1 REPLY 1
Message 2 of 2
MarkPendergraft
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)

 

-Mark

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost