I am tring to replace a block in all my drawings (nearly 400) with a new one. I plan to write a script for the command _-insert and loop it through for all drawings. After redefining the block during _-insert command, I need to simulate "ESC" key press as I am using insert block only for redefining tbe block and not inserting. The ESC key press cancels the current insert command and the block is redefined. I found this technique at http://www.cadforum.cz/cadforum_en/qaID.asp?tip=19
Thus the only barrier for me is to simulate the "ESC" key press through autocad command equivalent of it. I have tried the following commands but nothing exits the _-insert block command.
CANCEL, C, ^C^C, ESCAPE, ESC.
If someone can please let me know the Text Command equivalent of pressing "ESC" key, I would be very grateful.
I don't have express tools installed. Here is the serries of interactions that I plan to put inside the script.
At AutoCAD command prompt enter command _-insert
Autocad prompts for "Enter block name or [?]". I Enter "oldBlock=C:\NewBlock.dwg"
Autocad prompts for "Block oldBlock already exists. Redefine it?" I enter "Yes"
Autocad redefines oldBlock and replaces all oldBlocks in drawing with the NewBlock.
Now Autocad prompts "Specify Insertion point or ...". At this point the old block has been redefined and all the instances of old block are replaced by the new block. Here I just want to skip the _-insert block command that initiated the whole process. So here I can press "ESC" key to cancel the _-insert block command. But I will be putting this interactions inside the script where I be unable to use the "ESC" key. So I needed some text equivalent of pressing "ESC" key.
Thanks for the reply. Unfortunately ^C does not work and the script still waits for the prompt ""Specify Insertion point or ...".
(Command) does cancel the _-insert command, but it stops the script execution too. The command line displays "Command:" and waits. What I wanted was to save the autocad drawing after the block has been redefined. Here is the script that I am looping for all autocad drawing files in particular directory.
_-insert 83=D:\Autocad\Temp\83.dwg (command) qsave quit Y
In the code "83" is the name of the old block that I am trying to replace with "D:\Autocad\Temp\83.dwg". After the block gets redefined, the script halts after "(Command)". Ideally, I would like to execute qsave and quit command (last 3 lines in the code above), but the script halts after "(Command)" function call above.
The ^C was meant as a code - depending on your text editor, you might enter it as Alt+003 or otherwise. Yes this will break both the command and the script.
You will probably need to use the other ways (e.g. blockreplace, riblock) to replace blocks in scripts which need to continue with other commands.
I managed to install "autocad 2000 express tools" using my installation CD. However autocad still tells that BLOCKREPLACE is an unknown command. Any ideas why this happens ?
R2000's ExpressTools may not have had it, or your install was incomplete: is it listed in ET's HELP?
There are hundreds of replace-block LISP routine freebies all over the internet, try a quick google search and grab one that works for you. Even my friend Michl above has one on his site's freebie section I believe.
In case anyone is looking for this information later - it came up in my search - the answer is....
without quotes or anything..
Here's how I use it in a LISP routine
(command "_.insert" (STRCAT BLK1 "=" BLK_PATH BLK1 ".DWG") #\ESCAPE
) ; END INSERT
I doubt that #\ESCAPE means anything special. It is just a symbol name with nothing (= nil) assigned. And nil acts as a Cancel in the (command) LISP function. Your question was about scripts, not LISP.
Instead of #\ESCAPE try e.g. ##hooptidoodle - it will do the same. Or just nil - which is the right way to do this.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.