Jump to content

My Macro Cannot Handle 2 RENAMEs in a Row


Recommended Posts

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]: RENAME

I 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_RENAME

But as soon as I attempt to add something, it goes to command line instead:

^C^C_RENAME;RENAME

Link to comment
Share on other sites

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.

 

 

quote_icon.png Originally Posted by ReMark viewpost-right.png

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.

Link to comment
Share on other sites

... 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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 4 weeks later...

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_RENAME

I 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?
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...