Another way [lightly tested]:
(defun C:PLOD ; = PolyLine at Orthogonal Directions [relative to 1st segment]
(/ svn svv pl pt1 pt2)
(setq
svn '(orthomode ucsfollow peditaccept osnapz); System Variable Names
svv (mapcar 'getvar svn); System Variable Values
); setq
(mapcar 'setvar svn '(0 0 1 1))
; turn off Ortho & UCS following, accept Lines in Pedit, force to Z=0
(command
"_.pline" pause pause ""
"_.ucs" "_object" "_last"
"_.ortho" "_on" ; for rubber-band lines & Change command
); command
(setq pl (entlast))
(while
(setq pt2
(getpoint
(setq pt1 (trans (vlax-curve-getEndPoint pl) 0 1))
"\nNext reference point: "
); getpoint
); setq
(command
"_.line" "_none" pt1 "_none" pt2 "" ; needs to be Line for next command:
"_.change" "_last" "" pt2 ; make it orthogonal in current UCS
"_.pedit" pl "_join" "_last" "" ""
); command
); while
(command "_.ucs" "_previous")
(mapcar 'setvar svn svv); reset
(princ)
); defun
A couple of differences from @doaiena 's latest:
The "rubber-banding" when asking for a next point [after the 1st segment] is always orthogonal ;
If the next point is more in the direction of a continuation of the previous direction than perpendicular to that, it uses the continuation direction [I'm not sure whether your intent was always for each segment to be perpendicular to the previous one, regardless of geometric relationship, or simply to be orthogonal relative to it].
[It could use the addition of *error* handling to ensure that the System Variables get reset, and maybe some other typical enhancements.]
Kent Cooper, AIA