jdofboise Posted February 8, 2013 Posted February 8, 2013 I need to add the selection of nested blocks to this code. I want to be able to select a block along with it's nested block to change their color to red. ;INTERNAL ERROR HANDLER (defun err-ubc (s) ; If an error (such as CTRL-C) occurs ; while this command is active... (if (/= s "Function cancelled") (princ (strcat "\nError: " s)) ) (setq *error* olderr) ; Restore old *error* handler (princ) );err-ubc (DEFUN C:UPDBLKCL (/ BLK CBL CBL2 C ACL ALY NLY NCL) (setq olderr *error* *error* err-ubc) (initget "?") (while (or (eq (setq C (getint "\nEnter new color number/<?>: ")) "?") (null C) (> C 256) (< C 0) );or (textscr) (princ "\n ") (princ "\n Color number | Standard meaning ") (princ "\n ________________|____________________") (princ "\n | ") (princ "\n 0 | <BYBLOCK> ") (princ "\n 1 | Red ") (princ "\n 2 | Yellow ") (princ "\n 3 | Green ") (princ "\n 4 | Cyan ") (princ "\n 5 | Blue ") (princ "\n 6 | Magenta ") (princ "\n 7 | White ") (princ "\n 8...255 | -Varies- ") (princ "\n 256 | <BYLAYER> ") (princ "\n \n\n\n") (initget "?") );while (PROMPT "\nPick blocks to update. ") (SETQ SS (SSGET '((0 . "INSERT")))) (SETQ K 0) (WHILE (< K (SSLENGTH SS)) (setq CBL (tblsearch "BLOCK" (CDR (ASSOC 2 (ENTGET (SETQ BLK (SSNAME SS K))))))) (SETQ CBL2 (CDR (ASSOC -2 CBL))) (WHILE (BOUNDP 'CBL2) (SETQ EE (ENTGET CBL2)) ;Update layer value (SETQ NCL (CONS 62 C)) (SETQ ACL (ASSOC 62 EE)) (IF (= ACL nil) (SETQ NEWE (APPEND EE (LIST NCL))) (SETQ NEWE (SUBST NCL ACL EE)) );if (ENTMOD NEWE) (SETQ CBL2 (ENTNEXT CBL2)) );end while (ENTUPD BLK) (SETQ K (1+ K)) );end while (setq *error* olderr) (princ) );end updblkcl 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.