Thank You So much Mircea and pBe..
I've checked the code and its working perfectly even for the points selected outside of polyline, but if i pick a point (not on polyline) i am not getting the perpendicular distance. Can you check it please.
If the user did pick a poitn outisde the pline. it will give you intead the distance between the pick point and perpendicular to polyline? is that correct?
Code:(defun c:test3 () (setq a (car (entsel "\nSelect polyline:"))) (setq pt (getpoint "\nPick point:")) (setq dist (if (vlax-curve-getDistAtPoint a pt) (vlax-curve-getDistAtParam a (vlax-curve-getParamAtPoint a pt)) (distance (vlax-curve-getClosestPointTo a pt) pt))) (princ (strcat "\nKP on this point is: " (rtos dist 2 3))) (princ) )
Not only the distance between a point picked and a point perpendicular to polyline but also the KP from a point which is perpendicular to polyline.
and offset could be positive and negative that means if my point picked is on right side it would be positive offset and if it is on left side then it would be negative.Code:(princ (strcat "\nKp on this point is:" "xyz" "and offset from route is:abc"))
I think that you will get that result by combining the code examples given by pBe and me - it will be a good exercise for you.
AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3
OK this will be my work...
anyways my problem is solved now.
I appreciate both of YOUR WORK and HELP for me.
I will come again with another question and another topic.
Thanks and Best Regards
Registered forum members do not see this ad.
I will definitely share here pBe.