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
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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)

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
(setq D (distance pt (osnap (cadr e1) "perp"))) ___

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks fellows, that is what I needed. This list is a gold mine. J
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.