- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good Morning All,
Does anybody have a lisp that will look at a block name in a list and if it exists, rename that block to a new name? Company was bought out and the new regime changed all of our part numbers. I have dozens of templates and hundreds of block in each. I have many of the blocks in a list as shown below. So if the list could look at the first part number "F102" and if it existed, rename to "300275" I would be a happy camper.
("F102 " "300275")
("F102-P " "300275-P")
("F102-S " "300275-S")
("F103 " "306259")
("F103-P " "306259-P")
("F103-S " "306259-S")
("F104 " "300274")
("F104-P " "300274-P")
("F104-S " "300274-S")
I . . . borrowed a lisp that I found on line but I have never been good at error trapping. Can somebody set me straight? Don
(defun c:RMB ( / lstBlocks)
;Rename Multiple Blocks
;Prep
(setq lstBlocks '(
;("old_name" "new_name")
("F102 " "300275")
("F102-P " "300275-P")
("F102-S " "300275-S")
("F103 " "306259")
))
;Begin work
(setvar 'CMDECHO 0)
(foreach blk lstBlocks
(command "-RENAME" "b" (car blk) (cadr blk))
);foreach
(setvar 'CMDECHO 1)
;Finish up
(prompt "\nBlock Re-Naming Complete.")
(princ)
);defun
Solved! Go to Solution.