Hi Jeff!
I didn't expect a reply so soon! Thanks.
I absolutely didn't mean to imply that your answer was wrong; I meant MY interpretation of the answer was wrong and I knew it. But I'm still stumped.
Here's all I'm doing, and frustratingly it seems to work SOME of the time and fail as many times as it succeeds (even on different segments of the same feature line):
(defun c:sr ()
(defun set-snapang (snang / ro)
(setq ro (angtos snang 4 4))
(princ (strcat "\nNew snap angle is " ro ". "))
(setvar "snapang" snang)
(setvar "cmdecho" 0)
)
(defun getro ( / en e pp p1 p2 etype)
(while (null en)
(setq e (entsel "\nSelect object to change snapangle to: ")
en (car e)
pp (cadr e)
etype (cdr (assoc 0 (entget en)))
)
)
(cond
( (equal "AECC_FEATURE_LINE" etype)
(setq p1 (vlax-curve-getclosestpointto en pp)
param (vlax-curve-getparamatpoint en p1)
vec (vlax-curve-getfirstderiv en param)
ang (angle '(0.0 0.0) vec)
)
(set-snapang ang)
)
( t
(princ "\nMust be line, lwpolyline, xline, text, dimension,
insert, hatch, feature line or viewport. Try again.")
)
)
)
(command "._UNDO" "BEG")
(getro)
(command "._UNDO" "END")
(princ)
)