The Hurricane Forum
The Hurricane Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Hurricane for AutoCAD
 Tips and Tricks
 How to REDEFINE a Block... (reinsert)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic   

Admin
Administrator



651 Posts

Posted - March 27 2002 :  5:25:36 PM  Show Profile  Visit Admin's Homepage  Reply with Quote
-HOW to "Redefine" a block in a drawing-

You may have come across the need to do this in the following situation...:

You inserted a block into hundreds of drawings (AS A BLOCK, NOT exploded), and it turns out that the block has an error in it. How do you fix the error?

You might try to use Hurricane to go through each of the drawings and "select" the block, erase it, purge the drawing, then re-insert the corrected block (but only if you know the coordinates! like with a title-block), but that could turn out to be a nightmare if each of your drawings contain more than one instance of the block, and/or each of the drawings scales are different!)

You may have inserted it in several places in the drawing, all at different coordinates.

So, is there a way to UPDATE a block which may appear multiple-times in a drawing in one shot?

YES.

Cut and paste this script into Hurricane and give it a name like SUBSTITUTE BLOCK.

Of course you will have to edit the word "SOURCEBLOCK" and PATH of the REPLACEMENT Block.

(To get the NAME of the sourceblock, select the block you wish to replace in your drawing, and type LIST, it's name will be displayed in your text window.
Set the path of the replacement block, and you should be all ready to run on multiple drawings.


The cool thing to note, is that after the block redefinition, the block name does not change, just it's visible contents.
AND - If the block contains any attributes, the attribute data is kept intact!



;SCRIPT TO SUBSTITUTE A BLOCK.
;THE SOURCE BLOCK MAY EXIST IN MANY
;PLACES IN THE DRAWING, ALL INSTANCES
;WILL BE REPLACED.
;BEGIN -------------------
ATTREQ 0
INSERT
"SOURCEBLOCK=C:PATHTOYOURREPLACEMENTBLOCK.DWG"
0,0



ERASE
(SETQ en (ENTLAST))

;END ------------------------




NOTES:

-The ATTREQ system variable turns off any prompts asking you to fill in Attribute information as the block is inserted.

-This script uses the regular INSERT command, and the command must finish cleanly for the script to complete cleanly. the use of in-line Lisp with the SETQ command selects the LAST entity in the drawing database.

Basically, because the INSERT command MUST insert a block to be able to complete the command/redefine a block, you end up with an extra instance of the new block at coordinates 0,0. The SETQ command is used with the ERASE to erase the last entity in the drawing database, hence erasing the last added block (which you didn't need anyway)

Notes:
1) Your new title-block will be inserted at the same coords as the old one, so make sure that you used the old one as a template to create the new one (so it aligns properly when you re-define it)

2) The "0,0" shown in the script is just a dummy coordinate, as the instance of the block inserted at 0,0 is erased anyhow. You might want to make it "-100,-100" so it stands out a bit more.

3) You can TEST your script with Hurricane, just select the "TRIAL RUN" checkbox, this way your edited drawings won't be saved, but the functions will be performed.

Hurricane for AutoCAD
http://www.74mph.com
  Previous Topic Topic   
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Hurricane Forum © 2009 - 2021 Go To Top Of Page
This page was generated in 0.3 seconds. Snitz Forums 2000