(defun c:rect_side_greather_than ( / adoc edge_length ss i j pointlist2d take eo pointset lenghts *error*)
(defun *error* ( msg )
(if (not (member msg '("Function cancelled" "quit / exit abort")))
(princ)
)
(if (and adoc) (vla-endundomark adoc))
(princ)
)
(defun pointlist2d (lst / ret) (while lst (setq ret (cons (take 2 lst) ret) lst (cddr lst))) (reverse ret))
(defun take (amount lst / ret)(repeat amount (setq ret (cons (car lst) (take (1- amount) (cdr lst))))))
(setq edge_length (getreal "\Enter minimal rectangle edge length >"))
(setq ss (ssget '((0 . "LWPOLYLINE") (8 . "Kolon"))) i -1)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-endundomark adoc)
(vla-startundomark adoc)
(while (< (setq i (1+ i)) (sslength ss))
(setq eo (vlax-ename->vla-object (ssname ss i)))
(setq pointset (pointlist2d (vlax-get eo 'Coordinates)))
(setq pointset (append pointset (list (car pointset))))
(setq lenghts nil j -1)
(while (< (setq j (1+ j)) (1- (length pointset)))(setq lenghts (cons (distance (nth j pointset)(nth (1+ j) pointset)) lenghts)))
(cond ((>= (apply 'max lenghts) edge_length) (vlax-put eo 'Color 3)))
)
(vla-endundomark adoc)
(princ "\nDone!")
(princ)
)
In case rectangle in not closed ie, edges are polyline segments, it will put color to green only to polyline edges greater than minimal length. If closed, rectangle will be changed to green. I would join all segmented rectangles to one single polyline it that is not a problem for you.
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.