Sorry this to be so old, it was a worthwhile learner though.
Just wanted to include re.usability of vars. Comments Please!
(defun c:p2p (/ *error*
enti curve point_on_curve wdst wdlt
param tangential_dir perp_angle1
perp_angle2 your_point_1 your_point_2
) ;; https://www.theswamp.org/index.php?topic=37522.msg425311#msg425311
(defun *error* ( msg )
(vla-endundomark (vla-get-activedocument (vlax-get-acad-object)))
(if qaf (setvar 'qaflags qaf))
(if msg (prompt msg))
(progn
(setvar 'osmode snw)
(setvar 'cmdecho 1)
)
(princ)
)
(setq snw (getvar 'osmode))
(setvar 'osmode (boole 6 (getvar 'osmode) 512)) ;; add nearest osnap to existing
;; first perp line
(if dst1 ;; set default if first run [nil]
(setq wdst 1.0)
)
(setq dst1 (getdist (strcat "\n First/Inner Distance: < was: " (rtos wdst 2 3)" > "))) ;; get offset, else <enter> for 1.0
(if dst1 ;; test for new entry
(setq wdst 1.0) ;; if not new entry, use 1
(setq dst1 wdst) ;; else use last/saved
)
(setq wdst dst1) ;; set next use prompt
;; second perp line
(if dst2 ;; set default if first run [nil]
(setq wdlt 1.0)
)
(setq dst2 (getdist (strcat "\n Second/Outer Distance: < was: " (rtos wdlt 2 3)" > "))) ;; get offset, else <enter> for 1.0
(if dst2 ;; test for new entry
(setq wdlt 1.0) ;; if not new entry, use 1
(setq dst2 wdlt) ;; else use last/saved
)
(setq wdlt dst2) ;; set next use prompt
(if (and ;; both 0 quit
(= dst1 0)
(= dst2 0)
)
(quit)
)
(princ (strcat " 1st: " (rtos dst1 2 3) " | 2nd: " (rtos dst2 2 3)))
(while
(setq pt (getpoint "\n Select object: " )
enti (nentselp pt) ;
curve (vlax-ename->vla-object (car enti))
point_on_curve (vlax-curve-getClosestPointTo curve (cadr enti))
param (vlax-curve-getParamAtPoint curve point_on_curve)
tangential_dir (vlax-curve-getFirstDeriv curve param)
perp_angle1 (+ (angle '(0 0) tangential_dir) (* 0.5 pi))
perp_angle2 (+ perp_angle1 pi)
your_point_1 (polar point_on_curve perp_angle1 dst1)
your_point_2 (polar point_on_curve perp_angle2 dst2)
) ;_ end of setq
(foreach % (list your_point_1 your_point_2)
(entmakex
(list
(cons 0 "LINE")
(cons 10 point_on_curve)
(cons 11 %)
) ;_ end of list
) ;_ end of entmakex
) ;_ end of foreach
) ;_ end of while
(setvar 'osmode snw) ;; restore osmode
(*error* nil)
(princ)
) ;_ end of defun