;; UDB.LSP ;; a routine to update a block by picking it ;;======================================================= (defun C:UDB ( / _FLAG ss1 ent ent_typ blk_nm blk_pth) (setq _FLAG T) (while _FLAG (prompt "\n Select BLOCK to update: ") (setq ss1 (ssget)) (cond ((= ss1 nil) (prompt "\nNothing selected, try again.")) ((> (sslength ss1) 1) (prompt "\nPlease pick only one entity, try again.")) ((= (sslength ss1) 1) (progn (setq ent (entget (ssname ss1 0))) (setq ent_typ (cdr (assoc 0 ent))) (if (= ent_typ "INSERT") (setq _FLAG nil) (prompt "\nEntity selected is not a BLOCK, try again.") );if );progn );cond test #4 );cond );while (setq blk_nm (strcat (cdr (assoc 2 ent)) ".DWG")) (setq blk_pth (findfile blk_nm)) (if (= blk_pth nil) (prompt "\n Program could not find a .DWG file for the block you picked.") (progn (setvar "CMDECHO" 0) (setq blk_nm (strcat (cdr (assoc 2 ent)) "=")) (command "INSERT" blk_nm) (command) );progn );if (princ) );defun