Drawn directions of either do not need to matter, and no calculation of intersecting points is needed, and I was not surprised by anything. Copy the victim in place, and Trim the original on one side of the cutting one, and the copy on the other side. On the assumption that there won't be other closed Polylines in the vicinity than the one you want split, this works in your drawing:
(defun C:SplitPL-KC
(/ cutss cutpl splitss splitpl1 splitpl2 cutmid cutlen outboard1 outboard2)
(prompt "\nFor cutting open Polyline {singular},")
(if
(and
(setq cutss (ssget "_:S+." '((0 . "LWPOLYLINE") (-4 . "<NOT") (-4 . "&") (70 . 1) (-4 . "NOT>"))))
;; single, open only
(setq
cutpl (ssname cutss 0)
splitss
(ssget "_F"
(mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget cutpl)))
'((0 . "LWPOLYLINE") (-4 . "&") (70 . 1)); closed only
); ssget & splitss
); setq
(= (sslength splitss) 1); only one to be split
); and
(progn ; then
(setq splitpl1 (ssname splitss 0))
(command "_.copy" splitpl1 "" '(0 0) '(0 0))
(setq
splitpl2 (entlast)
cutmid ; midway between ends of cutting one
(mapcar '/
(mapcar '+
(setq cutstart (vlax-curve-getStartPoint cutpl))
(setq cutend (vlax-curve-getEndPoint cutpl))
); +
'(2 2 2)
); /
cutdir (angle cutstart cutend)
cutlen (vlax-curve-getDistAtPoint cutpl (vlax-curve-getEndPoint cutpl))
outboard1 (polar cutmid (+ cutdir (/ pi 2)) cutlen)
outboard2 (polar cutmid (- cutdir (/ pi 2)) cutlen)
); setq
(command "_.trim" cutpl ""
(list splitpl1 (vlax-curve-getClosestPointTo splitpl1 outboard1))
(list splitpl2 (vlax-curve-getClosestPointTo splitpl2 outboard2))
""
); command
); progn
); if
(prin1)
)
Add a restriction to an unlocked Layer for the one to split if you want, and *error* handling and command-echo suppression and Undo begin-end wrapping and so on....
I imagine there could be more convoluted configurations in which it might not give the result you want, but it works in simple situations such as in your drawing. With minor adjustment, the same approach could work with other kinds of cutting edges [Line, "heavy" Polyline, Xline, Ray, etc.*] and other kinds of objects to be split ["heavy" Polyline, Circle, Ellipse, Spline, Mline, Xline, Ray, etc.]. *There would need to approximations made for the Fence selection if the cutting edge were to contain curvature(s), such as a Polyline with arc segment(s), or an Arc, Spline, or partial Ellipse.
Kent Cooper, AIA