Guest balajibth84 Posted October 17, 2010 Posted October 17, 2010 Thought some one could make use of this Will rename all blocks or just a single block, from selecting the target , Good for those random blocks or bad memory ;| Rename Blocks Created by FlowerRobot Created on 20/12/09 Rev 1.1 Will rename a single block or all blocks Rev history Rev 1.0 (unkown) Created Rev 1.1 20/12/09 Command defined simpler Varibles localised and tidy up |; (defun c:rre (/ Ent_BlkData Str_BkNme Str_NwBlkNme Bol_All Pt_BkPt Xscle Yscle Zscle Rotation OldOs Lst_EntInfo SS_1Block ;Subs *error* GetBlockEnts ) (defun *error* (Str_ErrorMsg /) (if ErrorDump (princ Str_ErrorMsg)) (vl-cmdf "_.undo" "_end") (vl-cmdf "_.undo" "1") (princ "An error accured exiting") (setvar "cmdecho" 1) (princ) ) (vl-load-com) (setvar "cmdecho" 0) (vl-cmdf "_.undo" "_begin") (defun GetBlockEnts (Str_BkNme / Ent_Blk lst_Item Ent_Nxt) (setq Ent_Blk (cdr (assoc -2 (tblsearch "block" Str_BkNme))) lst_Item (list (cdr (assoc -1(entget Ent_Blk)))) Ent_Nxt (entnext Ent_Blk)) (while Ent_Nxt (setq lst_Item (append (list(cdr (assoc -1(entget Ent_Nxt))))lst_Item) Ent_Nxt (entnext Ent_Nxt)) ) lst_Item ) (princ "\nSelect Block") (if(and (setq SS_1Block (ssget ":S" '((0 . "INSERT")))) (< 0 (strlen (setq Str_NwBlkNme (getstring "\nWhat is new name: ")))) ) (progn (setq Ent_BlkData (ssname SS_1Block 0) Lst_EntInfo (entget Ent_BlkData) Str_BkNme (cdr (assoc 2 Lst_EntInfo)) ) (initget 0 "YES NO") (cond ((tblsearch "block" Str_NwBlkNme) (princ (strcat "A Block \"" Str_NwBlkNme "\" already exists"))) ((if (= "NO" (getkword "\nRename all? : [YES/NO] <YES>")) nil t) (vl-cmdf "_Rename" "Block" Str_BkNme Str_NwBlkNme)) (t (entmake (list (cons 0 "BLOCK")(cons 2 Str_NwBlkNme)(cons 70 2)(cons 10 (list 0 0 0)))) (foreach Ent_Item (GetBlockEnts Str_BkNme) (entmake (entget Ent_Item)) ) (entmake (list (cons 0 "ENDBLK"))) (setq Pt_BkPt (cdr (assoc 10 Lst_EntInfo)) Xscle (cdr (assoc 41 Lst_EntInfo)) Yscle (cdr (assoc 42 Lst_EntInfo)) Rotation (cdr (assoc 50 Lst_EntInfo)) OldOs (getvar "osmode") ) (entdel Ent_BlkData) (setvar "osmode" 0) (vl-cmdf "_.Insert" Str_NwBlkNme Pt_BkPt Xscle Yscle (/(* 180 Rotation)pi)) (setvar "osmode" OldOs) ) ) ) (princ "Invalid data, Please try again tommorro") ) (vl-cmdf "_.undo" "_end") (setvar "cmdecho" 1) (princ) ) For Block Rename its very useful..But i dont want This Yes or No option(Rename all? : [YES/NO] ).So hw to remove that Yes or no option??(Rename all? : [YES/NO] )????????i want to update only selected block name..So here Yes or no option no need..So i want ro remove that option from ths lisp...plz help me 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.