AutoLisp-Need help on the Distance Comand

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

Reply to
jarvis
Loading thread data ...

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)

Reply to
Smackypete

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

Reply to
Paul Turvill

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

Reply to
jarvis

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.