Community
AutoCAD LT Forum
Welcome to Autodesk’s AutoCAD LT Forums. Share your knowledge, ask questions, and explore popular AutoCAD LT topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

replace blocks

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
ingraldi
4935 Views, 12 Replies

replace blocks

Need to replace various blocks with others in AutoCad 2018 LT

12 REPLIES 12
Message 2 of 13
steven-g
in reply to: ingraldi

All blocks with the same name? or just selected blocks?

Message 3 of 13
ingraldi
in reply to: steven-g

selected blocks

Message 4 of 13
steven-g
in reply to: ingraldi

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?

Message 5 of 13
ingraldi
in reply to: steven-g

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.

Message 6 of 13
pendean
in reply to: ingraldi

You will need to ERASE the old blocks, then INSERT new blocks.
Message 7 of 13
a_meteni
in reply to: ingraldi

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)

 

Message 8 of 13
hwalker
in reply to: a_meteni

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.

EESignature


Left Handed and Proud

Message 9 of 13
steven-g
in reply to: ingraldi

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.

 

Message 10 of 13
ingraldi
in reply to: steven-g

Thank you for the info.  I will give it a try.

Message 11 of 13
ingraldi
in reply to: steven-g

Hi Steven,

 

Followed the instructions and it worked, but for some reason the attribute of the block disappeared.  Any ideas?

Message 12 of 13
steven-g
in reply to: ingraldi

It's difficult without seeing the blocks in question, but attributes can be problematic when you add them to blocks which is normally solved by using the 'ATTSYNC' command and selecting the block in question.

Message 13 of 13

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.

Post to forums  

Technology Administrators


Autodesk Design & Make Report