johnalane Posted August 7, 2008 Posted August 7, 2008 Attached and submitted to site for free use, with acknowledgements if any improvments, please let me know, thank you john Block_Swap.lsp 1 Quote
Arch_Eric Posted August 12, 2008 Posted August 12, 2008 My version is similar, except you select one of the original blocks, then the new block, then create a selection box around the blocks you want to replace. (defun c:replace ( / old-block new-block block-sel lcv block) (setq old-block (entget (car (entsel "\nSelect the old block: "))) new-block (entget (car (entsel "\nSelect the new block: "))) lcv (princ "\nSelect blocks to be replaced: ") block-sel (ssget (list (assoc 2 old-block))) lcv 0) (while (< lcv (sslength block-sel)) (setq block (entget (ssname block-sel lcv))) (entmod (subst (assoc 2 new-block) (assoc 2 old-block) block)) (setq lcv (+ 1 lcv)) ) ) Quote
johnalane Posted August 12, 2008 Author Posted August 12, 2008 Thanks Eric Have a look at attached it belongs to Aleksandr Smirnov Lovely routine BUT....!!! when you swop/replace Blocks he REMOVES the Attributes of the Swopped Blocks which is a pity. Wish he would amend to retain attribute info as selected blocks are swopped over to a new block name.. Cheers john cblock.LSP 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.