Object Snap does not affect vlax-curve-* functions
This is not the cause since the code is successful when tested with an LWPolyline in the vicinity of the existing Polyline.
@aaryan: You can convert the Polyline to an LWPolyline using the CONVERTPOLY command.
Correct , but with Autocad 2013 it behaves with a bug most of the time and specially with the scale command .
I tried it with Autocad 2010 and nothing 's wrong with the code .
With LWPOLYLINE always works, but not with POLYLINE.
Try it the attached dwg with the objects moved near the UCS origin.
This solves all problems.
Or PLINETYPE = 2
Aaryan,
maybe not a very clean way to solve the problem but the "vlax-curve-getClosestPointTo" function sometimes does not work well, when the object is not orthogonal,
so the way I got to get around this situation is to calculate twice the closest point on the curve, so the second point is on the curve and therefore already calculates the distance on the curve without error,
(setq a (car (entsel "\nSelect Line:")))(setq b (getpoint "\nPickPoint"))(setq c (vlax-curve-getDistAtPoint a (vlax-curve-getClosestPointTo a (vlax-curve-getClosestPointTo a b T) T)))
test your code by rotating your line to the vertcal and to the horizontal, and see that the
"vlax-curve-getClosestPointTo" function works well if the object is orthogonal.
hope that helps
Henrique Sorry for being late But Thanks to ALL of YOU..
页:
1
[2]