View Full Version : My Macro Cannot Handle 2 RENAMEs in a Row
I have a macro that finishes with a RENAME Dialog Box. Originally I wanted to loop it twice, but as soon as I added the second RENAME it supressed the first one to the Command Line.
See below, it simply adds the text "RENAME" as the object type to rename:
Command: _RENAME
Enter object type to rename
[Block/Dimstyle/LAyer/LType/Material/multileadeRstyle/Style/Tablestyle/Ucs/VIew/
VPort]: RENAMEI need to add more commands to the end of this macro, but it falls over as soon as there is anything after the 1st RENAME command.
Here is that part of the Macro that works for a single instance of the Dialog Box:
^C^C_RENAMEBut as soon as I attempt to add something, it goes to command line instead:
^C^C_RENAME;RENAME
SLW210
8th Sep 2011, 04:39 pm
What are you trying to accomplish? I see no reason to open the dialog box twice. You need to make appropriate responses to the first command.
alanjt
8th Sep 2011, 04:50 pm
Must. Provide. More. Information.
ReMark
8th Sep 2011, 05:03 pm
Maybe he wants to rename the RENAME command. LOL
alanjt
8th Sep 2011, 05:04 pm
Maybe he wants to rename the RENAME command. LOL LoL, then he should use the REDEFINE command.
Lee Mac
11th Sep 2011, 03:10 pm
Try:
^C^C_RENAME;\;RENAME
To add a pause.
YZ
11th Sep 2011, 11:36 pm
What are you trying to accomplish? I see no reason to open the dialog box twice. You need to make appropriate responses to the first command.
When we import survey files from 3rd party software into dwg they always have Suffixes on the blocks and layers that we need to remove. So we use the first RENAME command to rename all the blocks, and the second for the layers.
Everytime I wish that the "*" would work in the command line, but it only works in the Dialog Box, which is the only reason we use Dialog. Otherwise we could write it into the macro and would not need any user input.
http://www.cadtutor.net/forum/images/misc_cadtutor/quote_icon.png Originally Posted by ReMark http://www.cadtutor.net/forum/images/buttons_cadtutor/viewpost-right.png (http://www.cadtutor.net/forum/showthread.php?p=426152#post426152)
Maybe he wants to rename the RENAME command. LOL
LoL, then he should use the REDEFINE command. I see the confusion. (Is REDEFINE a real command? It is not in LT.) We need 2 instances of the dialog box to pop up separately, not a RENAME within a RENAME!
Lee Mac
Try:
Code:
^C^C_RENAME;\;RENAME
To add a pause.Whenever I try to pause for user input it suppress RENAME to the command line. So I end up with something like this:
RENAME Enter object type to rename
[Block/Dimstyle/LAyer/LType/Material/multileadeRstyle/Style/Tablestyle/Ucs/VIew/
VPort]: RENAME
Invalid option keyword.
BlackBox
12th Sep 2011, 03:24 am
... So complete the command at the comand line, and simply include a "\" to pause for user input where necessary?
YZ
12th Sep 2011, 03:39 am
... So complete the command at the comand line, and simply include a "\" to pause for user input where necessary?
I agree and would prefer to use the command line.
However there can be anywhere up to 15 blocks and 80 layers, with a variable list depending on each project.
We use a "*" to select all the blocks to be renamed, for example:
Rename: CAD_SYMBOL_*
To: * The * works in the dialog box, but returns "Unknown Block Name" when used in the Command Line. That is the only reason I am persisting with 2 dialog box commands.
ReMark
12th Sep 2011, 11:03 am
Do it the old fashioned way and drop down into a DOS command line and do all your renaming there using a batch file and wildcards.
BlackBox
12th Sep 2011, 11:22 am
That *should* not be necessary; to use the command line version of the RENAME command, use -RENAME instead (note the preceding hyphen "-").
As I understand it, anything that can be done using the dialog can be done programmatically via the command line version as well. Perhaps you (YZ) could post a more complete version of your command line code, so that we may better suggest how to accomplish this task?
Sorry for the delay, I've been run off my feet until today. Sweet breathing space. To process dwg files from third party software I always do the following macro:
Z;E;^C^C-UNITS;2;3;2;5;90;Y;'graphscr;^C^C-layer LO *CONTOURS F *TRIANGLES LO _CONTOUR* LO TITLE ;_ai_selall SETBYLAYER Y N -layer U *CONTOURS U _CONTOUR* U TITLE ;^C^C_qselect _erase;-PURGE;A;*;N;^C^C_RENAMEI want to add more to the macro, but the rename fails as soon as I add anything else into the macro afterward. I can work around it by having a second button macro, but I cannot understand why it will not work.
That *should* not be necessary; to use the command line version of the RENAME command, use -RENAME instead (note the preceding hyphen "-").
As I understand it, anything that can be done using the dialog can be done programmatically via the command line version as well. Perhaps you (YZ) could post a more complete version of your command line code, so that we may better suggest how to accomplish this task?
RenderMan, I would much prefer to use "-rename" but the wildcard does not work in the command line. Anyone is welcome to try it, I have posted about that quirk previously and have even made a business case to Autodesk development team.
Do it the old fashioned way and drop down into a DOS command line and do all your renaming there using a batch file and wildcards. ReMark, I had never thought of that. I will check it out. But from memory a batch file can call on AutoCAD scripts, which would presumably run into the same wildcard dilemma?
Powered by vBulletin™ Version 4.1.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.