AutoLisp-Need help on the Distance Comand

Jul 20, 2003 3 Replies

I need some help from someone on the Distance command in AutoLisp.



assume: (setq PT (getpoint )) and (setq E1 (entsel)) where E1 is a line.



I want to get the distance from the point PT "perpendicular" to the user selected line E1



I have tried something like this, but doesn't work: (setq D ( distance PT "per" E1 ) ) and other various variations but can't figure it out.



Thanks for any help Jarvis


Here is one solution:

(setq a (getpoint "\n Select Point: ")) (princ "\n Select Line: ") (setq b (vlax-curve-getClosestPointTo (vlax-ename->vla-object (car (entsel))) a)) (princ "\n") (princ (distance a b)) (princ)

(setq D (distance pt (osnap (cadr e1) "perp"))) ___

Thanks fellows, that is what I needed. This list is a gold mine. J

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required