@ishaq03 Here is my code that don't require selection angles through keyboard entries.
After you create first segments, at each next point a fan of colored helping lines appears inclined to desired angles relative to previous polyline segment. To pick point at desired angle assure you have osnap mode NEAREST turned on.
You can either pick a point along desired inclined line or place a cursor over desired line so that symbol of nearest is active and enter distance to next point. To exit hit <enter>

(defun c:inc_pline ( / *error* adoc pt deg_to_rad make_helplines elist base_angles_list pa pb pe po ptlist coords)
;Author: hak_vz
;Monday, September 20, 2021
;https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5530556
;Posted at
;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-for-automatic-change-the-angle/td-p/10632287
;Creates lwpolyline with inclined angles 11.25 22.5 45 60 and 90 degree relative to previous segment
;Important: Assure you have osnap mode NEAREST turned on to enable drawing along helper line
(vl-load-com)
(defun *error* ( msg )
(if (not (member msg '("Function cancelled" "quit / exit abort")))
(princ)
)
(if elist (foreach e elist (entdel e)))
(setq elist nil)
(if (and adoc) (vla-endundomark adoc))
(setvar 'cmdecho 1)
(princ)
)
(defun deg_to_rad (deg)(* pi (/ deg 180.0)))
(defun take (amount lst / ret)(repeat amount (setq ret (cons (car lst) (take (1- amount) (cdr lst))))))
(defun make_helplines (p1 ptlist / clist i p2)
(setq clist '(1 3 5 6 30 1 3 5 6 30))
(if elist (foreach e elist (entdel e)))
(progn
(setq elist nil i -1)
(while (< (setq i (1+ i)) (length ptlist))
(setq p2 (nth i ptlist))
(setq elist
(cons
(entmakex
(list
(cons 0 "LINE")
(cons 100 "AcDbEntity")
(cons 100 "AcDbLine")
(cons 10 (trans p1 1 0))
(cons 11 (trans (polar p1 (angle p1 p2) 10000) 1 0))
(cons 62 (nth i clist))
)
)
elist
)
)
)
)
)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-endundomark adoc)
(vla-startundomark adoc)
(setq base_angles_list (mapcar 'deg_to_rad '(11.25 22.5 45 60 90 -11.25 -22.5 -45 -60 -90)))
(princ "\nHave you tourned on osnap mode NEAREST? If not, turn it on and start again!")
(princ "\nTo exit function hit <enter>!")
(setq pa (getpoint "\nFirst point of polyline: "))
(setq pb (getpoint pa "\nNext point of polyline: "))
(setvar 'cmdecho 0)
(command "_.pline" pa pb "")
(setq pe (entlast) po (vlax-ename->vla-object pe))
(setq coords (append (take 2 pa) (take 2 pb)))
(setq ptlist nil)
(foreach e base_angles_list (setq ptlist (cons (polar pb (- (angle pa pb) e) 10) ptlist)))
(make_helplines pb ptlist)
(setq ptlist nil)
(while (setq pt (getpoint "\nNext point >"))
(setq pa pb pb pt)
(foreach e base_angles_list (setq ptlist (cons (polar pb (- (angle pa pb) e) 10) ptlist)))
(make_helplines pb ptlist)
(setq ptlist nil)
(command "_.pline" pa pb "")
(setq coords (append coords (take 2 pb)))
(vlax-put po 'Coordinates coords)
(entdel (entlast))
)
(if elist (foreach e elist (entdel e)))
(setq elist nil)
(vla-endundomark adoc)
(setvar 'cmdecho 1)
(princ "\nDone!")
(princ)
)
Miljenko Hatlak

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.