vlax-curve-getdistatpoint

vlax-curve-getdistatpoint

john.uhden
Mentor Mentor
516 Views
3 Replies
Message 1 of 4

vlax-curve-getdistatpoint

john.uhden
Mentor
Mentor

Is there any reason this function would return 0 if the point provided is not at the start of an LWPolyline?

Maybe it's because I'm using 2002?

John F. Uhden

0 Likes
Accepted solutions (1)
517 Views
3 Replies
Replies (3)
Message 2 of 4

CodeDing
Advisor
Advisor

@john.uhden ,

 

No, there should be no reason. Are you encountering a scenario where it is? Provide insight if so

0 Likes
Message 3 of 4

Kent1Cooper
Consultant
Consultant

It does that if you give it the start/end of a closed one, even if you request it for the end point:

(vlax-curve-getDistAtPoint pline (vlax-curve-getEndPoint pline))

returns zero [also for other closed shapes -- Circle, Ellipse, Spline].  But the Parameter approach to the same question does give the length of the Polyline [or other].

 

If you're not talking about the start/end point, is it just close enough to the start for display rounding to show zero?  Post a little drawing indicating where the Point in question is along the Polyline.

Kent Cooper, AIA
0 Likes
Message 4 of 4

john.uhden
Mentor
Mentor
Accepted solution

@CodeDing & @Kent1Cooper ,

It was all my fault.

Before you ask for distatpoint, you have to get the closestpointto...

(defun @getdistatpoint (e p)
  (vlax-curve-getdistatpoint e
    (vlax-curve-getclosestpointto e p)
  )
)

The zero was my own mistake (embarrassing).

John F. Uhden