(defun getplinepointlist(ename) (setq ent(entget ename)) (setq ptlist (list)) (while (setq pt(assoc 10 ent)) (setq ptlist (append ptlist (list pt))) (setq ent(cdr(member pt ent))) ) (setq pt nil ent nil) (setq pt ptlist) ) (defun c:rect_quads() (command "undo" "Be") (setq ents (ssget '((0 . "LWPOLYLINE")))) (setq cnt -1) (repeat (sslength ents) (setq ptlist (getplinepointlist (ssname ents (setq cnt (1+ cnt))))) (setq distX (/(distance (cdr(nth 0 ptlist))(cdr(nth 1 ptlist))) 8)) (setq angX (angle (cdr(nth 0 ptlist)) (cdr(nth 1 ptlist)))) (setq distY (/(distance (cdr(nth 0 ptlist))(cdr(nth 3 ptlist))) 8)) (setq angY (angle (cdr(nth 0 ptlist)) (cdr(nth 3 ptlist)))) (setq cntX -1) (repeat 8 (setq x1(nth 0 (polar (cdr(nth 0 ptlist)) angX (* (setq cntX (1+ cntX)) distX)))) (setq x2(nth 0 (polar (cdr(nth 0 ptlist)) angX (* (1+ cntX) distX)))) (setq cntY -1) (repeat 8 (setq y1(nth 1 (polar (cdr(nth 0 ptlist)) angY (* (setq cntY (1+ cntY)) distY)))) (setq y2(nth 1 (polar (cdr(nth 0 ptlist)) angY (* (1+ cntY) distY)))) (command "pline" (list x1 y1) (list x1 y2) (list x2 y2) (list x2 y1) "C" ) ) ));repeat (command "erase" ents "") (command "Undo" "end") (setq ptlist nil) )