Hi @Engineer_Yasser,
I agree with @ronjonp, i'v tried many option to choose the true "right" side from to block (which I also don't know where it is), but, after all I made something (which "I hope") that will help you for this situation (or even help to someone to improve this code or even made a new one).
Try the following:
; ************************************************************************
; Functions : CHCOLPL
; Description : Change the colors of the Polylines into the yellow
; Author : SAXLLE
; Date : January 08, 2025
; ************************************************************************
(defun c:CHCOLPL ( / ss len i ssn ename ent_pl data spt ept 2ndpt 3rdpt midpt lenn tlen k)
(setq ss (ssget "X" '((0 . "INSERT") (8 . "BLK") (2 . "blll")))
len (sslength ss)
i 0
)
(while (< i len)
(setq ssn nil)
(setq ename (ssname ss i))
(command-s "_explode" ename "")
(setq ent_pl (ssget "x" '((0 . "LWPOLYLINE") (8 . "BLK") (62 . 1) (70 . 1)))
data (entget (ssname ent_pl 0))
spt (cdr (nth 15 data))
2ndpt (cdr (nth 20 data))
3rdpt (cdr (nth 25 data))
ept (cdr (nth 30 data))
midpt (polar spt (angle spt ept) (/ (distance spt ept) 2))
)
(command-s "_undo" 1 "")
(setq ssn (ssget "_F" (list spt ept) '((0 . "LWPOLYLINE") (8 . "Poly")))
lenn (sslength ssn)
)
(if (= lenn 1)
(setq k 0)
(setq k 1)
)
(setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn 0)) 'Length))
(while (< k lenn)
(if (< tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length))
(progn
(setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length)
sssn (ssname ssn k)
)
)
(progn
(setq sssn (ssname ssn k))
)
)
(setq k (1+ k))
)
(setq eptn (vlax-curve-getEndPoint (vlax-ename->vla-object sssn)))
(if (> (cadr midpt) (cadr eptn))
(progn
(setq ssn (ssget "_F" (list spt ept) '((0 . "LWPOLYLINE") (8 . "Poly"))))
(command-s "_chprop" ssn "" "c" 2 "")
)
(progn
(setq ssn (ssget "_F" (list 2ndpt 3rdpt) '((0 . "LWPOLYLINE") (8 . "Poly")))
lenn (sslength ssn)
)
(if (= lenn 1)
(setq k 0)
(setq k 1)
)
(setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn 0)) 'Length))
(while (< k lenn)
(if (< tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length))
(progn
(setq tlen (vlax-get-property (vlax-ename->vla-object (ssname ssn k)) 'Length)
sssn (ssname ssn k)
)
)
(progn
(setq sssn (ssname ssn k))
)
)
(setq k (1+ k))
)
(setq midpt (polar 2ndpt (angle 2ndpt 3rdpt) (/ (distance 2ndpt 3rdpt) 2)))
(setq eptn (vlax-curve-getEndPoint (vlax-ename->vla-object sssn)))
(setq ssn (ssget "_F" (list midpt eptn) '((0 . "LWPOLYLINE") (8 . "Poly"))))
(command-s "_chprop" ssn "" "c" 2 "")
)
)
(setq i (1+ i))
)
(princ)
)
From the attached picture, I can't change the color of polylines into the yellow from the blue "circle" (it changed the color from the "wrong" side).