Community
I've got a list of xrefs / blocks that I'm trying to put through a set of commands. What I need to happen is this:
1. Isolate one item from the list.
2. Run the set of commands.
3. Remove the isolated item from the list.
4. Repeat items 1 thru 3 until no items are left in the list.
Here is some of the code, and if you see anything that could be changed, please let me know.
;; Object Selection List (princ "\nPick X-Refs or Blocks to copy objects from... ") (setq XRLIST (ssget '((-4 . "<OR")(0 . "INSERT")(-4 . "OR>")))) ;; Save Selection Window (princ "\nDraw selection window...") (COMMAND "._Select" "_si" "CPolygon") (while (eq 1 (logand 1 (getvar "cmdactive"))) (COMMAND pause)) (setq SS1 (ssget "P")) (setq BNDY (mapcar 'cadr (cdr (last (ssnamex SS1))))) ;; Rebuild Selection Window (defun buildpolyline (SS1 /) (setq pointlst (cdr (assoc '-1 (ssnamex ss 0)))) (setq pointlst (mapcar '(lambda (x) (cadr x)) pointlst)) (setq nextpnt (car pointlst) pointlst (cdr pointlst)) (command "pline" nextpnt) (while (setq nextpnt (car pointlst)) (command nextpnt) (setq pointlst (cdr pointlst))) (command "close") (setq nextpnt (car pointlst) pointlst (cdr pointlst)) (command "pline" nextpnt) (while (setq nextpnt (car pointlst)) (command nextpnt) (setq pointlst (cdr pointlst))) (command "close") ) ;; Step Through List (repeat (setq inc (sslength XRLIST)) (setq XREF (ssname XRLIST (setq inc (1- inc)))) ;; Commands to run on isolated object in list (command "-refedit" XREF "O" "N" "WP" (buildpolyline BNDY) "N" "_copy" "ALL" "" ZBASE ZBASE "_refset" "R" "ALL" "" "_refclose" "D" ) )