Maybe this... I've only moved your last line into (if -> then statement); else statement is unnecessary...
- (defun builditemlist ( l / item ins_block sublist ) (if l (progn ;if l isnt empty ;Take first item in l (setq item (car l)) ;grab data from INSERT reference (x and y insertion) (setq ins_block (cdr (assoc 10 (entget item))) ) ;grab data from BLOCK reference (l and w) ;make a list of the form (ssname x y l w A) (setq sublist (list item ins_block) ) (cons sublist (builditemlist (cdr l))) ) ))
The main function should have call to obtain sel. set "ss" and (builditemlist) function should operate on list of entity names obtained from sel. set "ss"...
- (setq ss (ssget '((0 . "INSERT"))))(setq tobeshelved (builditemlist (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
|