For a polyline, I would agree to use the vlax-curve-* functions, however, since an MLine is not a Curve Object, one cannot use the vlax-curve-* functions with it.
Below is an example to return the interior & exterior angles of the selected segment of an MLine, the returned angles are formatted using the angtos function so that you can see which angles are being calculated, but in practice, radians would be returned.
(defun c:test ( / e l p )
(if
(and
(setq e (entsel "\nSelect MLine: "))
(setq p (trans (cadr e) 1 0))
(eq "MLINE" (cdr (assoc 0 (setq e (entget (car e))))))
)
(progn
(setq l (LM:mAssoc 11 e))
(setq p
(car
(vl-sort-i
(mapcar
(function
(lambda ( a b )
(distance p (LM:ProjectPointToLine p a b))
)
)
l (append (cdr l) (list (car l)))
)
'<
)
)
)
(
(lambda ( a ) (mapcar 'angtos (list a (- (+ pi pi) a))))
(cond
( (zerop p)
(LM:GetLeftAngle (last l) (car l) (cadr l))
)
( (= p (1- (length l)))
(LM:GetLeftAngle (nth (1- p) l) (last l) (car l))
)
( t
(LM:GetLeftAngle (nth (1- p) l) (nth p l) (nth (1+ p) l))
)
)
)
)
)
)
(defun LM:mAssoc ( key lst / pair )
(if (setq pair (assoc key lst))
(cons (cdr pair) (LM:mAssoc key (cdr (member pair lst))))
)
)
(defun LM:ProjectPointToLine ( pt p1 p2 / nm )
(setq nm (mapcar '- p2 p1)
p1 (trans p1 0 nm)
pt (trans pt 0 nm)
)
(trans (list (car p1) (cadr p1) (caddr pt)) nm 0)
)
(defun LM:GetLeftAngle ( p1 p2 p3 )
(rem (+ pi pi (- (angle p2 p1) (angle p2 p3))) (+ pi pi))
)
(vl-load-com) (princ)