Need to replace various blocks with others in AutoCad 2018 LT
Solved! Go to Solution.
Solved by steven-g. Go to Solution.
Then you will have to take those blocks out of the drawing and place them into a new drawing first (there is no magic way in LT to just work on a selection)
Next question is it a big change or just something minor that could be done in the block editor, and would the insert point remain constant?
There are many fire alarm blocks and they all need to be replaced to comply with local code changes. The block names are different and the insertion point is the same.
We're using this routine and it works fine:
(defun c:zrbl (/ abunw abus1 abul abux abuna abue1 abuop abunp abue2) (setvar "cmdecho" 0) (setq abunw (getstring "\n>>> New block name: ")) (if (tblsearch "block" abunw) (progn (setq abus1 (ssget)) (setq abul (sslength abus1)) (setq abux 0) (repeat abul (setq abuna (ssname abus1 abux)) (setq abue1 (entget abuna)) (setq abuop (assoc 2 abue1)) (setq abunp (cons (car abuop) abunw)) (setq abue2 (subst abunp abuop abue1)) (entmod abue2) (setq abux (1+ abux)) );REPEAT (prompt "\n** G.Z. **\n** RBL: ") (prompt (itoa abul)) (prompt " blocks replaced.") );PROGN (progn (prompt "\n>>> Did you say ") (prompt abunw) (prompt " ?\n>>> Sorry, there is no such block in this drawing !!!!\n") );PROGN );IF (princ) );DEFUN (defun *error* (msg) (princ "\n>>> ERROR: ") (princ msg) (princ) );DEFUN (prompt "\n*** G.Z.***\n")(princ) (prompt "*** RBL: replaces selected blocks by a new block, retaining the old XYZ scales.")(princ)
Lisp does not work in LT
Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Yeah no magic buttons in LT, but assuming you have more blocks than can be manually swapped out in a couple of minutes then you can try the following, it is going to be complicated to explain and take longer to explain than it would take to do this. But I'll go through the sequence anyway.
You need 3 open drawings
1 your existing drawing "existing.dwg"
2 an empty drawing "old block.dwg"
3 a drawing with the new block inserted all on its own "new block.dwg"
step one select all the blocks that need changing in "existing.dwg" and press Ctrl+shift+C (copy with base point), Autocad will prompt you for a point just type 0,0 followed by enter, then type "erase" and enter the old blocks will vanish.
goto old block.dwg and press Crtl+v this pastes the blocks into this drawing again you will be prompted for an insert point type 0,0 followed by enter.
You might need to zoom extents to see things!
now in new block.dwg run the rename command and change the name of the new block so that it is exactly the same as the old block you have in the other drawing (I have probably lost you by now - just reread it a couple of times)
back to old block.dwg and open design center Ctrl+2 (or ADCENTER) open the tree view and navigate to the block section of open drawings "new block.dwg" and right click on the name of block (which now has the old name) select "Redefine only" from the options. this will change all the blocks in old block.dwg to the new version. Run the rename command again and this time give the old blocks a new name (this is important or placing them back into the existing drawing they will revert back)
Now select all these new blocks press Ctrl+shift+C use 0,0 as the base point at the prompt, go back to the existing.dwg and press Crtl+v and again use 0,0.
Done
You can now close and delete the other two files.
As I said doing the whole sequence is a lot quicker than writing it down, and if you are still here and want to try it then I would advise doing all this on a copy of your drawing just in case. You need to remove the blocks from the original drawing because rename doesn't work on just a selection it will rename every block in the drawing. So this is a good way to change every block in a drawing as well, just redefine them using a new block with the same name.
Hi Steven,
Followed the instructions and it worked, but for some reason the attribute of the block disappeared. Any ideas?
Hi all,
Just stabled on a way to replace blocks in LT, I've replaced everything inside the block editor with the 'new' block, saved it, exit block editor. selected all the 'old blocks' and explode them.
Thanks
Can't find what you're looking for? Ask the community or share your knowledge.