Cazza Posted October 29, 2012 Posted October 29, 2012 Could someone please help me modify this LISP code as I am a begginer when it comes to LISP. I found the below LISP on one of the forums on this site and it is great, only problem is that I can only select one attribute at a time. Is there any way to change this to select a window rather than individually? (defun mydcl (zagl info-list / fl ret dcl_id) (vl-load-com) (if (null zagl) (setq zagl "Select") ) ;_ end of if (setq fl (vl-filename-mktemp "mip" nil ".dcl")) (setq ret (open fl "w")) (mapcar '(lambda (x) (write-line x ret)) (list "mip_msg : dialog { " (strcat "label=\"" zagl "\";") " :list_box {" "alignment=top ;" "width=51 ;" (if (> (length info-list) 26) "height= 26 ;" (strcat "height= " (itoa (+ 3 (length info-list))) ";") ) ;_ end of if "is_tab_stop = false ;" "key = \"info\";}" "ok_cancel;}" ) ;_ end of list ) ;_ end of mapcar (setq ret (close ret)) (if (setq dcl_id (load_dialog fl)) (if (new_dialog "mip_msg" dcl_id) (progn (start_list "info") (mapcar 'add_list info-list) (end_list) (set_tile "info" "0") (setq ret (car info-list)) (action_tile "info" "(setq ret (nth (atoi $value) info-list))") (action_tile "cancel" "(progn(setq ret nil)(done_dialog 0))") (action_tile "accept" "(done_dialog 1)") (start_dialog) ) ;_ end of progn ) ;_ end of if ) ;_ end of if (unload_dialog dcl_id) (vl-file-delete fl) ret ) ;;;=============================================== ================================= ;;;Written By Michael Puckett. ;;;(setq all_layers (tablelist "LAYER")) (defun tablelist (s / d r) (while (setq d (tblnext s (null d))) (setq r (cons (cdr (assoc 2 d)) r)) ) ) (defun C:CHATTLAY ( / *error* lay att ed blk blkdef doc) (vl-load-com) (setq doc (vla-get-activedocument(vlax-get-acad-object))) (if (setq lay (mydcl "Select layer" (acad_strlsort (tablelist "LAYER")))) (progn (while (setq att (nentselp "\nSelect attribute :")) (if (= (cdr(assoc 0 (setq ed (entget(setq att(car att)))))) "ATTRIB") (progn (setq att (vlax-ename->vla-object att)) (setq blk (vla-objectidtoobject doc (vla-get-ownerid att))) (setq blkdef (vla-item (vla-get-blocks doc)(vla-get-name blk))) (vlax-for itm blkdef (if (and (= (vla-get-objectname itm) "AcDbAttributeDefinition") (= (strcase(vla-get-tagstring itm))(strcase(vla-get-tagstring att)))) (progn (vla-put-layer itm lay) (vla-put-layer att lay) ) ) ) (vla-update blk) ) ) ) ) ) (princ) ) (princ "\nType CHATTLAY to run") Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.