;;;Edit attributes or text in blocks one at a time (sequentially) ;;;Any TEXT entity edits are applied to all blocks because they are actually edits to the block definition. ;;; ;;; Author: Henry C. Francis ;;; 425 N. Ashe St. ;;; Southern Pines, NC 28387 ;;; http://paracadd.com ;;; All rights reserved. ;;; ;;; COPYRIGHT: 8/6/2007 ;;; EDITED: 8/6/2007 ;;; ;;;Requires: UKWORD.LSP ;;; (DEFUN atted1_error (msg /) (PRINC (STRCAT "\nError: " msg)) (SETQ *error* orig_atted1error) (TERM_DIALOG) (PRINC) ) ;_ end of DEFUN (DEFUN c:atted1 () (SETQ orig_atted1error *error*) (WHILE (AND (/= edit_this_text "Yes") (SETQ attrib_ent (NENTSELP)) attrib_ent (NOT (EQ (CDR (ASSOC 0 (ENTGET (CAR attrib_ent)))) "ATTRIB")) ) ;_ end of AND (IF (EQ (CDR (ASSOC 0 (ENTGET (CAR attrib_ent)))) "TEXT") (PROGN (IF ukword nil (LOAD "UKWORD" "\nFile UKWORD.LSP not loaded! ") ) ;_ end of IF (SETQ edit_this_text (ukword 1 "Yes No" (STRCAT "Do you want to edit this text in all blocks like this one? [Yes/No]") last_edit_this ) ;_ end of ukword last_edit_this edit_this_text ) ;_ end of SETQ ) ;_ end of PROGN ) ;_ end of IF (PRINC (STRCAT "\n" (CDR (ASSOC 0 (ENTGET (CAR attrib_ent)))) " selected (not ATTRIB). Select again. ") ) ;_ end of PRINC (PRINC) ) ;_ end of WHILE (IF attrib_ent (PROGN (IF (EQ edit_this_text "Yes") (PROGN (SETQ text_to_edit (CDR (ASSOC 1 (ENTGET (CAR attrib_ent)))))) (PROGN (SETQ step_ent (CAR attrib_ent)) (WHILE (/= (CDR (ASSOC 0 (ENTGET step_ent))) "SEQEND") (SETQ step_ent (ENTNEXT step_ent))) (SETQ this_insert (CDR (ASSOC -2 (ENTGET step_ent)))) (SETQ this_insert_name (CDR (ASSOC 2 (ENTGET this_insert)))) (SETQ this_name (TBLOBJNAME "block" this_insert_name)) (WHILE (SETQ this_name (ENTNEXT this_name)) (IF (AND (ASSOC 2 (ENTGET this_name)) (EQUAL (ASSOC 2 (ENTGET this_name)) (ASSOC 2 (ENTGET (CAR attrib_ent)))) ) ;_ end of AND (PROGN (IF (NOT (EQ (CDR (ASSOC 0 (ENTGET this_name))) "SEQEND")) (SETQ prev_name this_name) ) ;_ end of IF ) ;_ end of PROGN ) ;_ end of IF ) ;_ end of while (IF (AND prev_name (EQ (CDR (ASSOC 0 (ENTGET prev_name))) "ATTDEF") (NOT (EQ (CDR (ASSOC 0 (ENTGET (CAR attrib_ent)))) "SEQEND")) ) ;_ end of AND (PROGN (SETQ text_to_edit (CDR (ASSOC 1 (ENTGET (CAR attrib_ent)))) this_tag (CDR (ASSOC 2 (ENTGET prev_name))) this_prompt (CDR (ASSOC 3 (ENTGET prev_name))) ) ;_ end of SETQ (SET_TILE "block_string" this_insert_name) (SET_TILE "tag_string" this_tag) (SET_TILE "prompt_string" this_prompt) (SET_TILE "text_edit" text_to_edit) ) ;_ end of PROGN (IF (EQ (CDR (ASSOC 0 (ENTGET (CAR attrib_ent)))) "SEQEND") (TERM_DIALOG) ) ;_ end of IF ) ;_ end of IF ) ;_ end of PROGN ) ;_ end of IF (SETQ atted1_dlg# (LOAD_DIALOG "atted1.dcl")) (SETQ newdlg_atted1 (NEW_DIALOG "atted1" atted1_dlg# (IF defact_atted1 defact_atted1 "" ) ;_ end of IF (IF atted1_loc atted1_loc '(-1 -1) ) ;_ end of IF ) ;_ end of NEW_DIALOG ) ;_ end of SETQ (IF (EQ edit_this_text "Yes") (PROGN (SETQ this_tag "") (SETQ this_prompt "") (SETQ edit_this_text nil) (MODE_TILE "next_attrib" 1) (MODE_TILE "tag_string" 1) (MODE_TILE "prompt_string" 1) ) ;_ end of PROGN (PROGN (MODE_TILE "next_attrib" 0) (MODE_TILE "tag_string" 0) (MODE_TILE "prompt_string" 0)) ) ;_ end of IF (MODE_TILE "text_edit" 2) (IF errmsg (SET_TILE "error" errmsg) ) ;_ end of IF (SET_TILE "block_string" this_insert_name) (SET_TILE "tag_string" this_tag) (SET_TILE "prompt_string" this_prompt) (SET_TILE "text_edit" text_to_edit) (ACTION_TILE "text_edit" "(setq new_text $value)") (ACTION_TILE "prev_attrib" "(prev_attr)") (ACTION_TILE "next_attrib" "(next_attr)") (ACTION_TILE "accept" "(edit_str)(setq atted1_loc(done_dialog 2)errmsg \"\")") ;_ end of ACTION_TILE (ACTION_TILE "cancel" "(SETQ atted1_loc(done_dialog 2)errmsg nil)") (START_DIALOG) (UNLOAD_DIALOG atted1_dlg#) ) ;_ end of PROGN ) ;_ end of IF (SETQ *error* orig_atted1error) ) ;_ end of DEFUN (DEFUN next_attr () (edit_str) (SETQ attrib_ent (SUBST (ENTNEXT (CAR attrib_ent)) (CAR attrib_ent) attrib_ent)) (SETQ step_ent (CAR attrib_ent)) (WHILE (/= (CDR (ASSOC 0 (ENTGET step_ent))) "SEQEND") (SETQ step_ent (ENTNEXT step_ent))) (SETQ this_insert_name (CDR (ASSOC 2 (ENTGET (CDR (ASSOC -2 (ENTGET step_ent))))))) (SETQ next_name (TBLOBJNAME "block" this_insert_name)) (WHILE (SETQ next_name (ENTNEXT next_name)) (IF (AND (ASSOC 2 (ENTGET next_name)) (EQUAL (ASSOC 2 (ENTGET next_name)) (ASSOC 2 (ENTGET (CAR attrib_ent)))) ) ;_ end of AND (PROGN (IF (NOT (EQ (CDR (ASSOC 0 (ENTGET next_name))) "SEQEND")) (SETQ prev_name next_name) ) ;_ end of IF (SETQ this_name next_name) ) ;_ end of PROGN ) ;_ end of IF ) ;_ end of while (IF (AND this_name (EQ (CDR (ASSOC 0 (ENTGET this_name))) "ATTDEF") (NOT (EQ (CDR (ASSOC 0 (ENTGET (CAR attrib_ent)))) "SEQEND")) ) ;_ end of AND (PROGN (SETQ text_to_edit (CDR (ASSOC 1 (ENTGET (CAR attrib_ent)))) this_tag (CDR (ASSOC 2 (ENTGET this_name))) this_prompt (CDR (ASSOC 3 (ENTGET this_name))) ) ;_ end of SETQ (SET_TILE "block_string" this_insert_name) (SET_TILE "tag_string" this_tag) (SET_TILE "prompt_string" this_prompt) (SET_TILE "text_edit" text_to_edit) ) ;_ end of PROGN (IF (EQ (CDR (ASSOC 0 (ENTGET (CAR attrib_ent)))) "SEQEND") (TERM_DIALOG) ) ;_ end of IF ) ;_ end of IF (MODE_TILE "text_edit" 2) ) ;_ end of DEFUN ;;;(DEFUN prev_attr () ;;; (edit_str) ;;; (SETQ attrib_ent (SUBST (ENTNEXT (CAR attrib_ent)) (CAR attrib_ent) attrib_ent)) ;;; (SETQ step_ent (CAR attrib_ent)) ;;; (WHILE (/= (CDR (ASSOC 0 (ENTGET step_ent))) "SEQEND") (SETQ step_ent (ENTNEXT step_ent))) ;;; (SETQ this_insert_name (CDR (ASSOC 2 (ENTGET (CDR (ASSOC -2 (ENTGET step_ent))))))) ;;; (SETQ next_name (TBLOBJNAME "block" this_insert_name)) ;;; (WHILE (SETQ next_name (ENTNEXT next_name)) ;;; (IF (AND (ASSOC 2 (ENTGET next_name)) ;;; (EQUAL (ASSOC 2 (ENTGET next_name)) (ASSOC 2 (ENTGET (CAR attrib_ent)))) ;;; ) ;_ end of AND ;;; (PROGN (IF (NOT (EQ (CDR (ASSOC 0 (ENTGET next_name))) "SEQEND")) ;;; (SETQ prev_name next_name) ;;; ) ;_ end of IF ;;; (SETQ this_name next_name) ;;; ) ;_ end of PROGN ;;; ) ;_ end of IF ;;; ) ;_ end of while ;;; (IF (AND this_name ;;; (EQ (CDR (ASSOC 0 (ENTGET this_name))) "ATTDEF") ;;; (NOT (EQ (CDR (ASSOC 0 (ENTGET (CAR attrib_ent)))) "SEQEND")) ;;; ) ;_ end of AND ;;; (PROGN (SETQ text_to_edit (CDR (ASSOC 1 (ENTGET (CAR attrib_ent)))) ;;; this_tag (CDR (ASSOC 2 (ENTGET this_name))) ;;; this_prompt (CDR (ASSOC 3 (ENTGET this_name))) ;;; ) ;_ end of SETQ ;;; (SET_TILE "tag_string" this_tag) ;;; (SET_TILE "prompt_string" this_prompt) ;;; (SET_TILE "text_edit" text_to_edit) ;;; ) ;_ end of PROGN ;;; (IF (EQ (CDR (ASSOC 0 (ENTGET (CAR attrib_ent)))) "SEQEND") ;;; (TERM_DIALOG) ;;; ) ;_ end of IF ;;; ) ;_ end of IF ;;; (MODE_TILE "text_edit" 2) ;;;) ;_ end of DEFUN (DEFUN edit_str () (SETQ new_text (GET_TILE "text_edit")) (SETQ this_ent_def (ENTGET (CAR attrib_ent))) (SETQ this_ent_def (SUBST (CONS 1 new_text) (ASSOC 1 this_ent_def) this_ent_def)) (IF (EQ (CDR (ASSOC 0 this_ent_def)) "TEXT") (PROGN (ENTMOD this_ent_def) (ENTUPD this_insert) (SETQ this_insert_ss (SSGET "X" (LIST (CONS 2 this_insert_name))) ss_cnt 0 ss_len (SSLENGTH this_insert_ss) ) ;_ end of SETQ (WHILE (< ss_cnt ss_len) (ENTUPD (SSNAME this_insert_ss ss_cnt)) (SETQ ss_cnt (1+ ss_cnt))) ) ;_ end of PROGN (PROGN (ENTMOD this_ent_def) (ENTUPD (CDR (ASSOC -1 this_ent_def)))) ) ;_ end of IF ) ;_ end of DEFUN (DEFUN C:EA1 () (C:ATTED1)) ;|«Visual LISP© Format Options» (120 2 15 2 T "end of " 100 9 2 1 nil nil nil nil T) ;*** DO NOT add text below the comment! ***|;