;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vertical-lines-between-two-poly-line-points/td-p/8894065
(defun c:vline (/ *error* c_doc ms e_obj f_obj ent ans cnt e_p s_pt e_pt x_obj i_pt)
(defun *error* ( msg )
(mapcar 'setvar sv_lst sv_vals)
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
(if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred.")))
(princ)
);_end_*error*_defun
(setq sv_lst (list 'cmdecho 'osmode)
sv_vals (mapcar 'getvar sv_lst)
c_doc (vla-get-activedocument (vlax-get-acad-object))
ms (vla-get-modelspace c_doc)
e_obj (vlax-ename->vla-object (car (entsel "\nSelect Extents Polyline : ")))
f_obj (vlax-ename->vla-object (setq ent (car (entsel "\nSelect From Polyline : "))))
);end_setq
(initget "All Select")
(setq ans (cond ( (getkword "\nLine from All Vertices of Polyline or Selected Points [All/Select] <All> : ")) ("All")))
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
(vla-startundomark c_doc)
(cond ( (= ans "All")
(setq cnt 1.0
e_p (vlax-curve-getendparam ent)
);end_setq
(while (< 0.0 cnt e_p)
(setq s_pt (vlax-curve-getpointatparam ent cnt)
e_pt (mapcar '+ s_pt (list 0.0 1.0 0.0))
x_obj (vla-addray ms (vlax-3D-point s_pt) (vlax-3D-point e_pt))
i_pt (vlax-invoke x_obj 'intersectwith e_obj acextendnone)
cnt (1+ cnt)
);end_setq
(cond (i_pt (setq l_obj (vla-addline ms (vlax-3d-point s_pt) (vlax-3d-point i_pt)))))
(vla-delete x_obj)
);end_while
)
(t
(mapcar 'setvar sv_lst (list 0 545))
(while (setq s_pt (getpoint "\nSelect Line Start Point : "))
(cond ( (not (equal 0.0 (distance s_pt (vlax-curve-getclosestpointto ent s_pt)) 0.001))
(setq e_pt (mapcar '+ s_pt (list 0.0 -1.0 0.0))
x_obj (vla-addray ms (vlax-3D-point s_pt) (vlax-3D-point e_pt))
i_pt (vlax-invoke x_obj 'intersectwith f_obj acextendnone)
);end_setq
)
(t
(setq e_pt (mapcar '+ s_pt (list 0.0 1.0 0.0))
x_obj (vla-addray ms (vlax-3D-point s_pt) (vlax-3D-point e_pt))
i_pt (vlax-invoke x_obj 'intersectwith e_obj acextendnone)
);end_setq
)
);end_cond
(cond (i_pt (setq l_obj (vla-addline ms (vlax-3d-point s_pt) (vlax-3d-point i_pt)))))
(vla-delete x_obj)
);end_while
)
);end_cond
(if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
(mapcar 'setvar sv_lst sv_vals)
);end_defun