i need to calculate of the coordinates of point, insertion pt of text, end points of lines,lwpolylines that exist in a block. The block may just consist of points only or may contain nested blocks. the final result is to get the coordinates of each each entity. attached dwg is the final result that i require.
I have revised my codes and if it only returns the coordinates of those entities not nested and I need help for those nested blocks within the block.
(defun c:testr ( / nextntt nttlist insertlist ename AllCoords-List)
(if (setq ref (entsel "\nSelect a block "))
(progn
;; http://www.theswamp.org/index.php?topic=14347.msg173186#msg173186
;; By Gile 01.09.2007
(setq ref (car ref)
r_lst (entget ref)
y1 (cdr (assoc 41 r_lst))
y2 (cdr (assoc 42 r_lst))
y3 (cdr (assoc 43 r_lst))
y4 (cdr (assoc 50 r_lst))
y5 (cdr (assoc 10 r_lst))
)
(setq nextntt (tblobjname "block" (cdr (assoc 2 r_lst))))
(setq nttlist '())
(setq insertlist '())
(while (setq nextntt (entnext nextntt))
(if (eq "INSERT" (cdr (assoc 0 (entget nextntt))))
(setq insertlist (cons nextntt insertlist))
(setq nttlist (cons nextntt nttlist))
);if
)
)
);if
(setq AllCoords-List '())
(foreach ntt nttlist
(cond
((eq "POINT" (setq ename (cdr (assoc 0 (entget ntt)))))
(setq AllCoords-List (append
(transT (list (cdr (assoc 10 (entget ntt)))))
AllCoords-List))
);POINT
((eq "LINE" (setq ename (cdr (assoc 0 (entget ntt)))))
(setq AllCoords-List (append
(transT (list (cdr (assoc 10 (entget ntt)))))
AllCoords-List))
(setq AllCoords-List (append
(transT (list (cdr (assoc 11 (entget ntt)))))
AllCoords-List))
);LINE
);cond
);foreach
(print "allcoords-list ")(princ allcoords-list)
);testr
Hope i have explained in detail what i require.
thanks